Incorrect handling when reporting fn with optional compile time type #2862

This commit is contained in:
Christoffer Lerno
2026-01-28 18:51:21 +01:00
parent a07660f957
commit d276d3767f
3 changed files with 9 additions and 0 deletions

View File

@@ -140,6 +140,7 @@
- Crash when creating `$Type*` where `$Type` is an optional type #2848
- Crashes when using `io::EOF~!` in various unhandled places. #2848
- Crash when trying to create a const zero untyped list #2847
- Incorrect handling when reporting fn with optional compile time type #2862
### Stdlib changes
- Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads.

View File

@@ -3095,6 +3095,8 @@ INLINE const char *type_invalid_storage_type_name(Type *type)
return "a typeinfo";
case TYPE_WILDCARD:
return "an empty value";
case TYPE_OPTIONAL:
return "an optional with a compile time type";
default:
UNREACHABLE;
}

View File

@@ -0,0 +1,6 @@
fn $typeof({})? foo() {} // #error: A function may not return an optional with a compile time type, only macros may do
fn int main()
{
return 0;
}