- Comparing a flexible array member to another type would hit an assert. #2830

- Underlying slice type not checked correctly in $defined #2829
- Checking for exhaustive cases is done even in if-chain switch if all is enum #2828
This commit is contained in:
Christoffer Lerno
2026-01-24 17:57:56 +01:00
parent 396263f5c3
commit 5e23817a3d
9 changed files with 65 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
fn void test1()
{
bool a = $defined(void[]); // #error: You cannot form a slice with elements of type
}

View File

@@ -0,0 +1,5 @@
fn void test2()
{
bool b = $defined(void[*]); // #error: You cannot form an array with elements of type
}

View File

@@ -0,0 +1,4 @@
fn void test1()
{
bool a = $defined(void[<*>]); // #error: 'void' is not of a vectorizable type
}

View File

@@ -0,0 +1,12 @@
enum Baz
{
A, B, C,
}
fn void test_missing_all_cases(Baz x)
{
switch (x)
{
case x:
}
}
fn int main() => 0;

View File

@@ -0,0 +1,10 @@
struct Abc
{
int x;
int[*] y;
}
fn void test()
{
Abc y;
bool same = Abc.y == y.y; // #error: 'member_ref' and 'int[*]' are different types and cannot be compared
}