Files
swift-mirror/test/ClangImporter/explicit_existential.swift
Slava Pestov f886b38a0a ClangImporter: Import 'typedef id<P, Q> Foo' as a constraint type rather than an existential type
We want to be able to use these typealiases both as existential types
and as generic constraints, so unwrap the ExistentialType explicitly
before setting the underlying type of the typealias.

This might not be the best long-term approach, so I added a FIXME
comment with my thoughts there.

Fixes rdar://problem/88208893.
2022-02-01 16:52:26 -08:00

15 lines
516 B
Swift

// RUN: %target-typecheck-verify-swift %clang-importer-sdk -enable-objc-interop -import-objc-header %S/Inputs/explicit_existential.h
// Make sure that 'typedef id<P, Q> PAndQ' imports as a typealias without
// the ExistentialType wrapping the underlying type.
protocol InheritsFromQAndQ : PAndQ {}
func genericOverPAndQ<T : PAndQ>(_: T) {}
func takesSequenceOfPAndQ<T : Sequence>(_: T) where T.Element : PAndQ {}
func takesPAndQExistential(_ x: PAndQ) {
let b = PAndQProcessor()
b.takesPAndQExistential(x)
}