File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -10148,6 +10148,15 @@ static void finishTypeWitnesses(
1014810148 break ;
1014910149 }
1015010150
10151+ if (!satisfied && assocType->hasDefaultDefinitionType ()) {
10152+ auto defaultType = assocType->getDefaultDefinitionType ();
10153+ auto subMap =
10154+ selfType->getContextSubstitutionMap (assocType->getDeclContext ());
10155+ defaultType = defaultType.subst (subMap);
10156+ conformance->setTypeWitness (assocType, defaultType, assocType);
10157+ satisfied = true ;
10158+ }
10159+
1015110160 if (!satisfied) {
1015210161 ABORT ([&](auto &out) {
1015310162 out << " Cannot look up associated type for imported conformance:\n " ;
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+ // RUN: %empty-directory(%t/include)
3+ // RUN: split-file %s %t
4+ //
5+ // RUN: %target-swift-frontend -typecheck -module-name a -cxx-interoperability-mode=default -I %t/include %t/a.swift
6+
7+ //--- include/module.modulemap
8+ module cxx {
9+ header " header.h "
10+ export *
11+ }
12+
13+ //--- include/header.h
14+ struct S {
15+ S ( ) { }
16+ } __attribute__( ( swift_attr ( " conforms_to:a.P " ) ) ) ;
17+
18+ struct S2 {
19+ S2 ( ) { }
20+ using A = S2;
21+ } __attribute__( ( swift_attr ( " conforms_to:a.P " ) ) ) ;
22+
23+ //--- a.swift
24+ import cxx
25+ public protocol P {
26+ associatedtype A = Int
27+ func foo( _: A )
28+ }
29+ extension P {
30+ func foo( _: A ) { }
31+ }
32+ func test( s: S ) {
33+ let _ = s. foo ( 0 )
34+ }
35+ func test2( s: S2 ) {
36+ let _ = s. foo ( s)
37+ }
You can’t perform that action at this time.
0 commit comments