Invalid type constraint compiles successfully when specifying type intersection #16309
Labels
Area-Compiler-Checking
Type checking, attributes and all aspects of logic checking
Bug
Impact-Low
(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
This code is meant to be invalid, since additional restrictions of the form
:> SomeType
should not be used in type intersection:However, it compiles successfully, and you can use any not existing type name instead of ABRAKADABRA.
After decompilation, the false constraint is not present in the final build.
As you can see from the white identifier and unused open, the compiler doesn't even return a symbol for an existing type.
Reproducible in the main branch via test:
.NET 8.0.100
The text was updated successfully, but these errors were encountered: