You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sema: Fix doesMemberHaveUnfulfillableConstraintsWithExistentialBase() for generic context
We don't want to pass in the outer generic signature here.
The base type's constraint type is written in terms of archetypes,
and we run generic signature queries against it with types appearing
in the protocol member. Since the protocol member has Self at
depth 0, index 0, prepending the outer generic signature to the
opened existential signature would produce incorrect results.
// expected-error@-1 {{instance method 'method7' requires that 'U' conform to 'UnfulfillableGenericRequirements'}}
581
583
// expected-error@-2 {{member 'method7' cannot be used on value of type 'any UnfulfillableGenericRequirements'; consider using a generic constraint instead}}
584
+
585
+
exist.method8(false)
586
+
// expected-error@-1 {{member 'method8' cannot be used on value of type 'any UnfulfillableGenericRequirements'; consider using a generic constraint instead}}
587
+
}
588
+
589
+
// Make sure this also works in a generic context!
590
+
structG<X, Y, Z>{
591
+
func doIt(){
592
+
letexist:anyUnfulfillableGenericRequirements
593
+
594
+
exist.method8(false)
595
+
// expected-error@-1 {{member 'method8' cannot be used on value of type 'any UnfulfillableGenericRequirements'; consider using a generic constraint instead}}
596
+
}
582
597
}
583
598
protocolUnfulfillableGenericRequirementsDerived1:UnfulfillableGenericRequirementswhere A ==Bool{}
584
599
protocolUnfulfillableGenericRequirementsDerived2:UnfulfillableGenericRequirementswhere A ==Class<Self>{}
0 commit comments