Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0160-rdar41141944.swift
Pavel Yaskevich 235ed55004 [TypeChecker] When formatting witness type for diagnostics don't assume it's always valid
Sometimes witness candidates have error type e.g. when re-declaration checking
marks them as `invalid`, so formatting of the diagnostic
should account of potential witnesses not having a valid type.

Resolves: rdar://problem/41141944
2018-06-15 19:50:25 -07:00

19 lines
648 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %s -verify
// REQUIRES: objc_interop
import Foundation
@objc protocol P {
func foo(a arg: Int) // expected-note {{protocol requires function 'foo(a:)' with type '(Int) -> ()'; do you want to add a stub?}}
}
class C : P {
// expected-error@-1 {{type 'C' does not conform to protocol 'P'}}
var foo: Float = 0.75
// expected-note@-1 {{'foo' previously declared here}}
// expected-note@-2 {{candidate is not a function}}
func foo() {}
// expected-error@-1 {{invalid redeclaration of 'foo()'}}
// expected-note@-2 {{candidate has non-matching type '() -> ()'}}
}