-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Description
Previous ID | SR-15286 |
Radar | rdar://83929254 |
Original Reporter | @ahoppen |
Type | Bug |
Additional Detail from JIRA
Votes | 0 |
Component/s | |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: f7a7fb45fba6ec59908fe7403ab7acf2
Issue Description:
When typechecking the following, the first call of TokenWrapper(token: .test)
type checks fine, but the call inside the result builder later on fails with an error message Type of expression is ambiguous without more context
.
protocol ExpressibleAsTokenSyntax {}
struct TokenSyntax: ExpressibleAsTokenSyntax {}
extension ExpressibleAsTokenSyntax where Self == TokenSyntax {
static var test: TokenSyntax { TokenSyntax() }
}
struct TokenWrapper {
init(token: ExpressibleAsTokenSyntax) {}
}
@resultBuilder
struct MyBuilder {
public static func buildBlock(_ components: TokenWrapper...) -> TokenWrapper {
return components.first!
}
}
func build(@MyBuilder builder: () -> TokenWrapper) {}
// This compiles
TokenWrapper(token: .test)
// But this fails: Type of expression is ambiguous without more context
build {
TokenWrapper(token: .test)
}
Happens in both Swift 5.5 and swift-DEVELOPMENT-SNAPSHOT-2021-10-05-a.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.