Files
swift-mirror/test/diagnostics/testable-printast-locations.swift
Alexis Laferrière 72083bf7e3 Diagnostics: Specify the module name on ambiguities across modules
When a file defining an API is included in two modules, clients calling
that API may get an error about the ambiguity on the duplicated API.
That error is not very helpful when it takes into account the
swiftsourceinfo data and points to the source file instead of the
module. In such a case the notes point twice to the same file and line
of code.

Improve this diagnostic by appending the module name to the notes when a
candidate is found outside of the module.

rdar://116255141
2023-12-13 11:12:39 -08:00

14 lines
819 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -module-name ModuleA -emit-module-path %t/ModuleA.swiftmodule -primary-file %S/Inputs/TestablePrintASTLocationsModule.swift -enable-testing
// RUN: %target-swift-frontend -emit-module -module-name ModuleB -emit-module-path %t/ModuleB.swiftmodule -primary-file %S/Inputs/TestablePrintASTLocationsModule.swift -enable-testing
// RUN: not %target-swift-frontend -typecheck -I %t %s 2>&1 | %FileCheck %s
@testable import ModuleA
@testable import ModuleB
ambiguous()
// CHECK: testable-printast-locations.swift:[[@LINE-2]]:1: error: ambiguous use of 'ambiguous()'
// CHECK: ModuleA.ambiguous (internal):1:15: note: found this candidate in module 'ModuleA'
// CHECK: ModuleB.ambiguous (internal):1:15: note: found this candidate in module 'ModuleB'