mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
26 lines
619 B
Swift
26 lines
619 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: split-file %s %t
|
|
// RUN: %target-swift-frontend -typecheck -verify -primary-file %t/Usage.swift %t/Conformance.swift
|
|
|
|
//--- Conformance.swift
|
|
protocol P {
|
|
associatedtype A: Equatable
|
|
func f() -> A
|
|
}
|
|
|
|
extension P {
|
|
func f() -> A { fatalError() }
|
|
}
|
|
|
|
struct S: P {}
|
|
|
|
//--- Usage.swift
|
|
func callee(_: some Equatable) {}
|
|
|
|
// FIXME: This source location will become more accurate once TypeCheckExpr
|
|
// is a request! For now, pointing at the function is still better than crashing.
|
|
|
|
func caller() { // expected-error {{type 'S' does not conform to protocol 'P'}}
|
|
callee(S().f())
|
|
}
|