Skip to content

Commit b27fd2b

Browse files
committed
[TypeChecker] NFC: Add a couple of test-cases of partially applied static members with protocol metatype base
1 parent 618f563 commit b27fd2b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4573,7 +4573,7 @@ class ConstraintSystem {
45734573
ConstraintLocatorBuilder locator);
45744574

45754575
/// Simplify an equality constraint between result and base types of
4576-
/// a unresolved member chain.
4576+
/// an unresolved member chain.
45774577
SolutionKind simplifyUnresolvedMemberChainBaseConstraint(
45784578
Type first, Type second, TypeMatchOptions flags,
45794579
ConstraintLocatorBuilder locator);

test/Constraints/static_members_on_protocol_metatype.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ extension P {
3737

3838
_ = P.property // Ok
3939
_ = P.property.other // Ok
40+
_ = P.fnProp // Ok
4041
_ = P.fnProp() // Ok
4142
_ = P.fnProp().other // Ok
4243
_ = P.method() // Ok
44+
_ = P.method // Ok (partial application)
4345
_ = P.method().other // Ok
4446
_ = P.genericFn(42) // Ok
4547
_ = P.genericFn(42).other // Ok
@@ -50,8 +52,10 @@ _ = P[t: 42].other // Ok
5052

5153
let _: S = P.property // Ok
5254
let _: S = P.property.other // Ok
55+
let _: () -> S = P.fnProp
5356
let _: S = P.fnProp() // Ok
5457
let _: S = P.fnProp().other // Ok
58+
let _: () -> S = P.method // Ok
5559
let _: S = P.method() // Ok
5660
let _: S = P.method().other // Ok
5761
let _: G<Int> = P.genericFn(42) // Ok
@@ -113,7 +117,7 @@ test_combo(.genericFn(42)) // expected-error {{global function 'test_combo' requ
113117
extension P {
114118
static var invalidProp: Int { 42 } // expected-note 5 {{'invalidProp' declared here}}
115119
static var selfProp: Self { fatalError() }
116-
static func invalidMethod() -> Int { 42 } // expected-note 5 {{'invalidMethod()' declared here}}
120+
static func invalidMethod() -> Int { 42 } // expected-note 6 {{'invalidMethod()' declared here}}
117121
static func generic<T>(_: T) -> T { fatalError() } // expected-note 5 {{'generic' declared here}}
118122
static func genericWithReqs<T: Collection, Q>(_: T) -> Q where T.Element == Q { // expected-note 3 {{'genericWithReqs' declared here}} expected-note 3 {{required by static method 'genericWithReqs' where 'T' = '()'}}
119123
fatalError()
@@ -129,6 +133,8 @@ _ = P.invalidProp
129133
_ = P.invalidProp.other
130134
// expected-error@-1 {{cannot reference static property 'invalidProp' on 'P.Protocol' with non-conforming result type 'Int'}}
131135
// expected-error@-2 {{value of type 'Int' has no member 'other'}}
136+
_ = P.invalidMethod // Partial application with an invalid base type
137+
// expected-error@-1 {{cannot reference static method 'invalidMethod()' on 'P.Protocol' with non-conforming result type 'Int'}}
132138
_ = P.invalidMethod()
133139
// expected-error@-1 {{cannot reference static method 'invalidMethod()' on 'P.Protocol' with non-conforming result type 'Int'}}
134140
_ = P.invalidMethod().other

0 commit comments

Comments
 (0)