Files
swift-mirror/test/Macros/macro_explicit_generic_args.swift
Doug Gregor 7712903f6b Fix nondeterminism in explicitly-specified generic macro arguments
A hash table got flattened into an array without any ordering guarantees,
and then we assumed it was in order. Fixes rdar://121397992.
2024-01-30 12:40:23 -08:00

25 lines
629 B
Swift

// REQUIRES: swift_swift_parser
// RUN: %target-typecheck-verify-swift -swift-version 5
protocol P {
associatedtype A
}
@freestanding(expression)
macro resolve<T, U: P>(_ first: U.A, _ second: U) -> T = #externalMacro(module: "A", type: "B")
// expected-warning@-1{{external macro implementation type 'A.B' could not be found}}
// expected-note@-2{{'resolve' declared here}}
protocol Q { }
struct X: P {
typealias A = Int
}
func test(i: Int) {
_ = #resolve<any Q, X>(i, X())
// expected-error@-1{{external macro implementation type 'A.B' could not be found for macro 'resolve'; plugin for module 'A' not found}}
}