Files
swift-mirror/test/Constraints/rdar145593552.swift
Hamish Knight 96ae3fdb11 [AST] Look through specializations in getDirectCallee
This results in better recovery and fixes an assertion failure in
cases where we're attempting to diagnose a failure with the call.

rdar://145593552
2025-02-26 10:02:55 +00:00

11 lines
512 B
Swift

// RUN: %target-typecheck-verify-swift -swift-version 6
// rdar://145593552 - Make sure we don't crash.
func foo(_ x: Int) {} // expected-note {{'foo' declared here}}
foo<Void>("")
// expected-error@-1 {{cannot explicitly specialize global function 'foo'}}
// expected-error@-2 {{cannot convert value of type 'String' to expected argument type 'Int'}}
func bar(x: Int = 0) {} // expected-note {{'bar(x:)' declared here}}
bar<Void>() // expected-error {{cannot explicitly specialize global function 'bar(x:)'}}