Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0158-rdar40165062.swift
Slava Pestov 2d4b25960d Sema: Type variables for opened generic parameters store the generic parameter type and not an archetype
There's no need to instantiate archetypes in the generic environment
of the declaration being opened.

A couple of diagnostics changed. They were already misleading, and the
new diagnostics, while different, are not any more misleading than
before.
2018-09-27 20:49:23 -07:00

17 lines
432 B
Swift

// RUN: %target-typecheck-verify-swift
struct Foo<T, U> { // expected-note {{'U' declared as parameter to type 'Foo'}}
var value: U
func bar() -> Foo<T, U> {
return Foo(value)
// expected-error@-1 {{generic parameter 'U' could not be inferred}}
// expected-note@-2 {{explicitly specify the generic arguments to fix this issue}}
}
}
extension Foo where T == U {
init(_ value: U) {
self.value = value
}
}