Skip to content

Commit 9ac246a

Browse files
author
Greg Titus
committed
Raise impact of DefineMemberBasedOnUse to at least match RemoveInvalidCall.
1 parent a079c5c commit 9ac246a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11115,7 +11115,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyMemberConstraint(
1111511115

1111611116
auto instanceTy = baseObjTy->getMetatypeInstanceType();
1111711117

11118-
auto impact = 2;
11118+
auto impact = 10;
1111911119
// Impact is higher if the base type is any function type
1112011120
// because function types can't have any members other than self
1112111121
if (instanceTy->is<AnyFunctionType>()) {

test/Constraints/diagnostics.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,3 +1572,19 @@ func testNilCoalescingOperatorRemoveFix() {
15721572
if ("" // This is a comment
15731573
?? "").isEmpty {} // expected-warning {{left side of nil coalescing operator '??' has non-optional type 'String', so the right side is never used}} {{1572:9-1573:12=}}
15741574
}
1575+
1576+
// https://github.com/apple/swift/issues/74617
1577+
struct Foo_74617 {
1578+
public var bar: Float {
1579+
return 123
1580+
}
1581+
1582+
public static func + (lhs: Self, rhs: Self) -> Self {
1583+
return Self()
1584+
}
1585+
}
1586+
func testAddMemberVsRemoveCell() {
1587+
let a = Foo_74617()
1588+
let b = Foo_74617()
1589+
let c = (a + b).bar() // expected-error {{cannot call value of non-function type 'Float'}} {{22-24=}}
1590+
}

0 commit comments

Comments
 (0)