|
510 | 510 | // expected-error@+1 {{non-protocol, non-class type 'Sequence<${type}>' cannot be used within a protocol-constrained type}} |
511 | 511 | func invariant13() -> any P & Sequence<${type}> |
512 | 512 | func invariant14() -> (any Sequence<${type}>).Type |
| 513 | + func invariant15() -> any (P & Class<${type}>).Type |
513 | 514 |
|
514 | 515 |
|
515 | 516 | var invariantProp1: (inout ${type}) -> Void { get } |
|
523 | 524 | var invariantProp9: (Struct<() -> ${type}>) -> Void { get } |
524 | 525 | var invariantProp10: (any P & Class<${type}>) -> Void { get } |
525 | 526 | var invariantProp11: Struct<${type}>.InnerGeneric<Void> { get } |
| 527 | + var invariantProp15: any (P & Class<${type}>).Type { get } |
526 | 528 |
|
527 | 529 | subscript(invariantSubscript1 _: Struct<${type}>) -> Void { get } |
528 | 530 | subscript(invariantSubscript2 _: Void) -> Struct<${type}> { get } |
|
532 | 534 | subscript(invariantSubscript6 _: Struct<() -> ${type}>) -> Void { get } |
533 | 535 | subscript(invariantSubscript7 _: any P & Class<${type}>) -> Void { get } |
534 | 536 | subscript(invariantSubscript8 _: Void) -> Struct<${type}>.InnerGeneric<Void> { get } |
| 537 | + subscript(invariantSubscript15 _: Void) -> any (P & Class<${type}>).Type { get } |
535 | 538 | } |
536 | 539 |
|
537 | 540 | let exist: any P |
|
561 | 564 | var types = SwiftTypePair(typeOf: exist.invariant14(), type2: SwiftType<(any Sequence).Type>.self) |
562 | 565 | types.assertTypesAreEqual() |
563 | 566 | } |
| 567 | + exist.invariant15() // expected-error {{member 'invariant15' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
564 | 568 |
|
565 | 569 | exist.invariantProp1 // expected-error {{member 'invariantProp1' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
566 | 570 | exist.invariantProp2 // expected-error {{member 'invariantProp2' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
|
573 | 577 | exist.invariantProp9 // expected-error {{member 'invariantProp9' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
574 | 578 | exist.invariantProp10 // expected-error {{member 'invariantProp10' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
575 | 579 | exist.invariantProp11 // expected-error {{member 'invariantProp11' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
| 580 | + exist.invariantProp15 // expected-error {{member 'invariantProp15' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
576 | 581 |
|
577 | 582 | exist[invariantSubscript1: 0] // expected-error {{member 'subscript' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
578 | 583 | exist[invariantSubscript2: ()] // expected-error {{member 'subscript' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
|
582 | 587 | exist[invariantSubscript6: 0] // expected-error {{member 'subscript' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
583 | 588 | exist[invariantSubscript7: 0] // expected-error {{member 'subscript' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
584 | 589 | exist[invariantSubscript8: ()] // expected-error {{member 'subscript' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
| 590 | + exist[invariantSubscript15: ()] // expected-error {{member 'subscript' cannot be used on value of type 'any P'; consider using a generic constraint instead}} |
585 | 591 | } |
0 commit comments