Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions include/swift/Sema/CSFix.h
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,10 @@ class AllowInvalidPropertyWrapperType final : public ConstraintFix {
return "allow invalid property wrapper type";
}

bool diagnoseForAmbiguity(CommonFixesArray commonFixes) const override {
return diagnose(*commonFixes.front().first);
}

bool diagnose(const Solution &solution, bool asNote = false) const override;

static bool classof(const ConstraintFix *fix) {
Expand Down
12 changes: 12 additions & 0 deletions test/Sema/property_wrapper_parameter_invalid.swift
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,15 @@ func testInvalidWrapperInference() {
// expected-error@+1 {{contextual closure type '() -> Void' expects 0 arguments, but 1 was used in closure body}}
testExtraParameter { $value in }
}

// rdar://116522161 - failed to produce a diagnostic on invalid projection use
func testInvalidProjectionInAmbiguousContext() {
func test<T>(_: [T], _: (T) -> Void) {}

func ambiguous() -> Int { 42 }
func ambiguous() -> String { "" }

test([42]) { $v in // expected-error {{inferred projection type 'Int' is not a property wrapper}}
ambiguous()
}
}