Files
swift-mirror/test/Generics/canonicalization.swift
Doug Gregor 200d7d77f1 [Archetype builder] Infer same-type constraints for same-named associated types.
When two associated types with the same name are on the same dependent
type T, introduce a same-type constraint between the the corresponding
potential archetypes. This eliminates ordering dependencies in the
archetype builder.

Fixes the reduced test case from rdar://problem/23149063, but doesn't
fully address the idea that we should be tracking associated type
redeclarations in a meaningful way.
2017-01-24 19:36:44 -08:00

15 lines
362 B
Swift

// RUN: %target-typecheck-verify-swift
// rdar://problem/23149063
protocol P0 { }
protocol P {
associatedtype A
}
protocol Q : P {
associatedtype A
}
func f<T>(t: T) where T : P, T : Q, T.A : P0 { } // expected-note{{'f(t:)' previously declared here}}
func f<T>(t: T) where T : Q, T : P, T.A : P0 { } // expected-error{{invalid redeclaration of 'f(t:)'}}