Files
swift-mirror/validation-test/compiler_crashers_2_fixed/rdar65272763.swift
Slava Pestov 5ad4fa8b07 SIL: Don't canonicalize struct field and enum element types against the wrong signature
The replacement types of the substitution map are either going
to be contextual types, or interface types using some generic
signature. There is no requirement that this generic signature
is the generic signature of the type declaration itself.

By using the generic signature of the type declaration, we
could incorrectly canonicalize generic parameters to concrete
types if the type itself was defined in a constrained extension,
as in the test case here.

Fixes <rdar://problem/65272763>.
2020-08-11 22:54:19 -04:00

22 lines
368 B
Swift

// RUN: %target-swift-frontend -emit-ir %s
public struct S1<T1> {}
public extension S1 where T1 == Int {
public struct S2<T2> {
let value: T2
public init(value: T2) {
self.value = value
}
}
public init<T>(s: [S2<T>]) {
self.init()
s.forEach { _ in
}
}
}