diff options
| author | Julius Ikkala <julius.ikkala@gmail.com> | 2025-06-28 05:39:24 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-28 02:39:24 +0000 |
| commit | 7349dc5cff49cf22c82eb912813e47f30cd7a757 (patch) | |
| tree | 4d7b3e14f119e7bb48623e52c890b461fd3d9701 /tests/language-feature/interface-as-rhs-error.slang | |
| parent | a13dda4f214274a10d39f37c79622fc3e62da310 (diff) | |
Minimal optional constraints (#7422)
* Parse optional witness syntax
* Allow failing optional constraint
* Make `is` work with optional constraint
* Allow using optional constraint in checked if statements
* Fix tests
* Make it work with structs
* Fix MSVC build error
* Disallow using `as` with optional constraints
* Update test to match split is/as errors
* Add tests
* Fix uninitialized variables in tests
* Add tests of incorrect uses & fix related bugs
* Mention optional constraints in docs
* format code
* Fix type unification with NoneWitness
* Fix formatting
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Nathan V. Morrical <natemorrical@gmail.com>
Diffstat (limited to 'tests/language-feature/interface-as-rhs-error.slang')
| -rw-r--r-- | tests/language-feature/interface-as-rhs-error.slang | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/language-feature/interface-as-rhs-error.slang b/tests/language-feature/interface-as-rhs-error.slang index 9ad71afde..7293b5134 100644 --- a/tests/language-feature/interface-as-rhs-error.slang +++ b/tests/language-feature/interface-as-rhs-error.slang @@ -21,13 +21,13 @@ struct AnotherType // These should produce errors - interface types as RHS bool testIsOperatorWithInterface<T>() { - //CHECK: ([[# @LINE+1]]): error 30301: 'is' and 'as' operators do not support interface types as the right-hand side + //CHECK: ([[# @LINE+1]]): error 30301: cannot use 'is' operator with an interface type as the right-hand side return (T is IMyInterface); } void testAsOperatorWithInterface<T>(T value) { - //CHECK: ([[# @LINE+1]]): error 30301: 'is' and 'as' operators do not support interface types as the right-hand side + //CHECK: ([[# @LINE+1]]): error 30302: cannot use 'as' operator with an interface type as the right-hand side let result = value as IMyInterface; } |
