Skip to content

Commit 1056a9b

Browse files
committed
Add a multifile test that a dependency on an external protocol
conformance will block compilation if an associated type is invalid.
1 parent 6eb16f6 commit 1056a9b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
protocol PHelper {
2+
}
3+
4+
protocol P {
5+
associatedtype Assoc: PHelper // expected-note {{protocol requires nested type 'Assoc'}}
6+
}
7+
8+
struct A : P { // expected-error {{type 'A' does not conform to protocol 'P'}}
9+
typealias Assoc = Int // expected-note {{possibly intended match 'Assoc' (aka 'Int') does not conform to 'PHelper'}}
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %target-swift-frontend -emit-ir -verify %s %S/Inputs/external-protocol-conformance/A.swift
2+
3+
func generic<T: P>(value: T) {}
4+
5+
// The goal here is to verify that a dependency on an invalid associated
6+
// type in a protocol conformance in another file will prevent code
7+
// generation.
8+
func useGeneric() {
9+
generic(value: A())
10+
}

0 commit comments

Comments
 (0)