Skip to content

Commit 4f823c6

Browse files
committed
[Macros] Ensure that macros cannot return opaque result types
1 parent 3c80b71 commit 4f823c6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/Macros/macros_diagnostics.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33

44
macro stringify<T>(_ value: T) -> (T, String) = BuiltinMacros.StringifyMacro
55

6+
protocol P { }
7+
8+
macro tryToHide<T: P>(_: P) -> some P = BuiltinMacros.Blah
9+
// expected-error@-1{{some' types are only permitted in properties, subscripts, and functions}}
10+
11+
612
func test(a: Int, b: Int) {
713
// FIXME: Bad diagnostic.
814
let s = #stringify<Int, Int>(a + b) // expected-error{{type of expression is ambiguous without more context}}
915
}
16+

0 commit comments

Comments
 (0)