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.
17 lines
315 B
Swift
17 lines
315 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// SR-5726
|
|
protocol Foo
|
|
{
|
|
associatedtype Bar
|
|
var bar: Bar { get }
|
|
}
|
|
|
|
extension Foo where Self: Collection, Bar: Collection, Self.SubSequence == Bar.SubSequence, Self.Index == Bar.Index
|
|
{
|
|
subscript(_ bounds: Range<Index>) -> SubSequence
|
|
{
|
|
return bar[bounds]
|
|
}
|
|
}
|