Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test/Macros/bind_extensions_request_cycle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// RUN: %target-typecheck-verify-swift %s

@attached(member) @attached(peer)
public macro Foo(_: any P) = #externalMacro(module: "FooMacros", type: "FooMacro")
// expected-warning@-1 {{external macro implementation type 'FooMacros.FooMacro' could not be found for macro 'Foo'; plugin for module 'FooMacros' not found}}
// expected-note@-2 2 {{'Foo' declared here}}

public protocol P {}

@Foo(S.s)
struct A {
// expected-error@-1 2 {{external macro implementation type 'FooMacros.FooMacro' could not be found for macro 'Foo'; plugin for module 'FooMacros' not found}}
func a() {}
}

extension A {
struct Nested {}
}

// Binding this extension must not trigger macro expansion, because that
// performs a qualified lookup of S.s, which fails because the extension
// of P declared below has not been bound yet.
extension A.Nested {}

struct S: P {}

extension P where Self == S {
static var s: Self { Self() }
}