Skip to content

Commit d9e7ddf

Browse files
committed
Sema: Add a couple of passing diagnostic tests to static_members_on_protocol_in_generic_context.swift
It looks like we didn't test leading dot with instance members.
1 parent c3a1a4d commit d9e7ddf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/Constraints/static_members_on_protocol_in_generic_context.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,3 +363,18 @@ do {
363363
func testSomeMarkerProto<T: SomeMarkerProto>(_: T) {}
364364
testSomeMarkerProto(.answer())
365365
}
366+
367+
// Make sure we diagnose something for instance properties as well
368+
extension P {
369+
var instanceProp: S { S() }
370+
}
371+
372+
extension P where Self == S {
373+
var instanceProp2: S { S() }
374+
}
375+
376+
test(.instanceProp)
377+
// expected-error@-1 {{instance member 'instanceProp' cannot be used on type 'P'}}
378+
test(.instanceProp2)
379+
// expected-error@-1 {{instance member 'instanceProp2' cannot be used on type 'P'}}
380+
// expected-error@-2 {{property 'instanceProp2' requires the types 'Self' and 'S' be equivalent}}

0 commit comments

Comments
 (0)