mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Use the "override" information in associated type declarations to provide AST-level access to the associated type "anchor", i.e., the canonical associated type that will be used in generic signatures, mangling, etc. In the Generic Signature Builder, only build potential archetypes for associated types that are anchors, which reduces the number of potential archetypes we build when type-checking the standard library by 14% and type-checking time for the standard library by 16%. There's a minor regression here in some generic signatures that were accidentally getting (correct) same-type constraints. There were existing bugs in this area already (Huon found some of them), while will be addressed as a follow-up. Fies SR-5726, where we were failing to type-check due to missed associated type constraints.
27 lines
1.5 KiB
Swift
27 lines
1.5 KiB
Swift
import swift_mod_syn
|
|
|
|
func f(s : inout [Int]) {
|
|
s.sort()
|
|
}
|
|
|
|
// RUN: %empty-directory(%t.mod)
|
|
// RUN: %swift -emit-module -o %t.mod/swift_mod.swiftmodule %S/Inputs/swift_mod.swift -parse-as-library
|
|
// RUN: %sourcekitd-test -req=interface-gen -module swift_mod -- -I %t.mod > %t.response
|
|
// RUN: diff -u %s.response %t.response
|
|
|
|
// RUN: %sourcekitd-test -req=module-groups -module swift_mod -- -I %t.mod | %FileCheck -check-prefix=GROUP-EMPTY %s
|
|
// GROUP-EMPTY: <GROUPS>
|
|
// GROUP-EMPTY-NEXT: <\GROUPS>
|
|
|
|
// RUN: %swift -emit-module -o %t.mod/swift_mod_syn.swiftmodule %S/Inputs/swift_mod_syn.swift -parse-as-library
|
|
// RUN: %sourcekitd-test -req=interface-gen-open -module swift_mod_syn -- -I %t.mod == -req=cursor -pos=4:7 %s -- %s -I %t.mod | %FileCheck -check-prefix=SYNTHESIZED-USR1 %s
|
|
// SYNTHESIZED-USR1: s:s17MutableCollectionPssAARzs012RandomAccessB0Rzs10Comparable7Elements8SequencePRpzlE4sortyyF::SYNTHESIZED::s:Sa
|
|
|
|
// RUN: %sourcekitd-test -req=interface-gen-open -module Swift -synthesized-extension \
|
|
// RUN: == -req=find-usr -usr "s:s17MutableCollectionPssAARzs012RandomAccessB0Rzs10Comparable7Elements8SequencePRpzlE4sortyyF::SYNTHESIZED::s:Sa" | %FileCheck -check-prefix=SYNTHESIZED-USR2 %s
|
|
// SYNTHESIZED-USR2-NOT: USR NOT FOUND
|
|
|
|
// RUN: %sourcekitd-test -req=interface-gen-open -module Swift \
|
|
// RUN: == -req=find-usr -usr "s:s17MutableCollectionPssAARzs012RandomAccessB0Rzs10Comparable7Elements8SequencePRpzlE4sortyyF::SYNTHESIZED::s:Sa::SYNTHESIZED::USRDOESNOTEXIST" | %FileCheck -check-prefix=SYNTHESIZED-USR3 %s
|
|
// SYNTHESIZED-USR3-NOT: USR NOT FOUND
|