mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We shouldn't be allocating placeholders for type variables in the permanent arena, and we should be caching them such that equality works. To achieve this, we need to introduce a new "solver allocated" type property. This is required because we don't want to mark placeholder types with type variable originators as themselves having type variables, as it's not part of their structural type. Also update ErrorType to use this bit, though I don't believe we currently create ErrorTypes with type variable originators.
16 lines
610 B
Swift
16 lines
610 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
protocol P {
|
|
associatedtype A
|
|
}
|
|
|
|
func foo<T: P>(_: () throws -> T) -> T.A? { // expected-note {{where 'T' = 'Never'}}
|
|
fatalError()
|
|
}
|
|
|
|
let _ = foo() {fatalError()} & nil
|
|
// expected-error@-1 {{global function 'foo' requires that 'Never' conform to 'P'}}
|
|
// expected-error@-2 {{value of optional type 'Never.A?' must be unwrapped to a value of type 'Never.A'}}
|
|
// expected-note@-3 {{coalesce using '??' to provide a default when the optional value contains 'nil'}}
|
|
// expected-note@-4 {{force-unwrap using '!' to abort execution if the optional value contains 'nil'}}
|