mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
All but 7 tests now passing. Those 7 tests either do not refer to these circumstances or do not seem to pass even when modified to accept type specifications.
34 lines
1.3 KiB
Swift
34 lines
1.3 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: split-file %s %t
|
|
|
|
// RUN: %target-swift-frontend -emit-module %t/Lib.swift -module-name Lib -emit-module-path %t/Lib.swiftmodule
|
|
// RUN: %target-swift-frontend -typecheck -I %t -serialize-diagnostics-path %t/diags.dia %t/Client.swift -verify
|
|
// RUN: c-index-test -read-diagnostics %t/diags.dia > %t/diags.deserialized_diagnostics.txt 2>&1
|
|
// RUN: %FileCheck --input-file=%t/diags.deserialized_diagnostics.txt %t/Client.swift
|
|
|
|
//--- Lib.swift
|
|
|
|
public struct S {
|
|
public init(a: String) {}
|
|
@discardableResult // We use @discardableResult here to give this init a distinct line number in the pretty print.
|
|
public init(b: Int) {}
|
|
}
|
|
|
|
//--- Client.swift
|
|
|
|
import Lib
|
|
|
|
var x = S.init // expected-error {{ambiguous use of 'init'}}
|
|
// CHECK: {{.*[/\\]}}Client.swift:[[@LINE-1]]:11: error: ambiguous use of 'init'
|
|
|
|
// FIXME: Currently we can't check for 'init(a:)' because c-index-test is
|
|
// keying the source file contents on the buffer identifier, so we end up
|
|
// with duplicated 'init(b:)'.
|
|
|
|
// CHECK: Lib.S.init:2:8: note: found candidate with type '(String) -> S' in module 'Lib'
|
|
// CHECK: Lib.S.init:3:10: note: found candidate with type '(Int) -> S' in module 'Lib'
|
|
// CHECK: CONTENTS OF FILE Lib.S.init:
|
|
// CHECK: struct S {
|
|
// CHECK-NEXT: @discardableResult
|
|
// CHECK-NEXT: public init(b: Int)
|