Commit Graph

14478 Commits

Author SHA1 Message Date
bogwi 3c0ba5bb55 CHECK 4 done
The original errors:
1. `5024.odin(127:15) Error: Invalid use of a polymorphic type 'List($T)' in variable declaration`
2. `5024.odin(129:17) Error: Cannot determine polymorphic type from parameter: 'invalid type' to 'List($T)'`
Are gone. We now have a single, different error:
`5024.odin(124:28) Error: Unspecialized polymorphic types are not allowed in procedure parameters, got List($T)`

This error points directly to the `list : List($T)` parameter within the `List_Filter` procedure definition. This seems much more relevant to the actual problem (the interaction between the generic `List_Filter` and the concrete `default_filter`) than the original error about the variable declaration.

While this new error message might not be exactly pinpointing the default parameter issue, it correctly identifies the problematic procedure definition (`List_Filter`) as the source of the error, rather than the variable declaration (`my_list`). This seems like a step in the right direction for improving the error reporting for this kind of scenario.
2025-05-05 22:39:03 +09:00
bogwi af6b763449 CHECK 3 done
Enhance support for polymorphic procedures in type checking

1. In src/check_type.cpp, added special handling for polymorphic procedures used as default parameter values. We now allow a polymorphic procedure to be used as a default parameter value, even when its type parameters can't be immediately determined.

2. In src/check_expr.cpp, we modified the check_is_assignable_to_with_score function to handle the special case of assigning a polymorphic procedure as a default parameter. The function now allows a polymorphic procedure to be assigned to a concrete procedure type in this specific context.
2025-05-05 17:53:32 +09:00
bogwi af0e067a12 CHECK 2 done
Add support for handling generic types in LLVM backend

- Updated `lb_type_internal` to return a pointer type for unspecialized generics.
- Modified `write_type_to_canonical_string` to handle specialized generics without panicking.
- Enhanced `default_type` to return the default type of specialized generics when applicable.
2025-05-05 16:58:14 +09:00
bogwi ee8aeea381 CHECK 1 done
Fix panic in LLVM backend when using generic procedure with default arguments

- Fixed panic in `llvm_backend_proc.cpp` when using unspecialized polymorphic procedures as defaults.
- Ensured correct type inference when generic procedures are used as default parameters.
2025-05-05 16:50:40 +09:00
Laytan 93f80f60fb Merge pull request #5112 from blob1807/master
`core:bufio`: Fix typo from `b.w-b.w` to `b.w-b.r`
2025-05-05 03:00:46 +02:00
Jeroen van Rijn 32cef4c11b Fix change_times on Windows and simplify time handling in stat 2025-05-04 22:55:27 +02:00
Jeroen van Rijn 1ce3a9f766 Merge pull request #5114 from Kelimion/os2-fixes
os2: Don't try to translate Windows file attributes to Unix mode flags
2025-05-04 20:21:44 +02:00
Jeroen van Rijn 95923c2059 os2: Don't try to translate Windows file attributes to Unix mode flags
Also, fix `chmod`. It passed the wrong struct size to `SetFileInformationByHandle`.
2025-05-04 20:03:07 +02:00
blob1807 39752faba4 Fix typo from b.w-b.w -> b.w-b.r 2025-05-04 15:48:26 +10:00
Jeroen van Rijn 0f2a4b80ef Proper fix for executable name on Linux. 2025-05-04 01:05:10 +02:00
Jeroen van Rijn deededfb0a Fix executable_path info on Linux 2025-05-04 00:21:20 +02:00
Jeroen van Rijn c96d8237ba Clarify error messages for types that aren't simply comparable.
Previously, it implied that these are different types:
```
W:/Scratch/scratch.odin(17:5) Error: Cannot compare expression, operator '==' not defined between the types 'Handle_Map($T=u32, $HT=u32, $Max=10000)' and 'Handle_Map($T=u32, $HT=u32, $Max=10000)'
    if m == {} {
       ^~~~~~^
```
Now:
```
W:/Scratch/scratch.odin(20:5) Error: Cannot compare expression. Type 'Handle_Map($T=u32, $HT=u32, $Max=10000)' is not simply comparable, so operator '==' is not defined for it.
	if m == {} {
	   ^~~~~~^
```
2025-05-03 22:31:01 +02:00
Jeroen van Rijn 9681d88cd3 Fix #5107
Fixes #5107 by checking whether `result_count` is non-zero before indexing `type->Proc.results->Tuple.variables`.
2025-05-03 14:42:20 +02:00
Jeroen van Rijn 30c6fea9e9 Allow polymorphic #simd array as return type 2025-05-02 15:38:43 +02:00
gingerBill 19fe75f020 Merge pull request #5098 from laytan/fix-nan-comparisons
fix variable NaN comparisons
2025-05-02 13:00:42 +01:00
Jeroen van Rijn 7027d37596 Merge pull request #5103 from jasonKercher/better-box2d-build
Make build_box2d.sh more flexible
2025-05-02 04:57:58 +02:00
jason 87f5b96fcc Make build_box2d.sh more flexible
Removed the `odin root` call.
Seperated the clean rule in wasm.Makefile to enable parallel builds.
2025-05-01 22:42:32 -04:00
gingerBill 777c33a9a1 Merge pull request #5102 from Lperlind/attribute-no-sanitize-address
Add attribute @(no_sanitize_address)
2025-05-01 12:16:10 +01:00
Lucas Perlind 5c73b4ef58 Add attribute @(no_sanitize_address)
The purposes of this attribute is to let procedures opt-out of being
instrumented with asan. Typically an allocator that includes 'in-band'
meta-data will be accessing poisoned values (such as tlsf).

Making asan work with these allocators becomes very challenging so
just being to ignore asan within specific allocator procedures
makes it easier to reason and removes the need to temporarily
poison and unpoison allocator data.
2025-05-01 20:42:21 +10:00
Jeroen van Rijn 2d8ae2d23c Merge pull request #5100 from herohiralal/patch-1
Convention-related changes in `file_windows.odin`
2025-04-30 22:27:59 +02:00
Rohan Jadav f50698b901 updated file_windows.odin to follow coding conventions 2025-05-01 00:56:31 +05:30
Laytan dd0b8d5757 Merge pull request #5099 from laytan/add-alias-issue-tests-to-ci
adds the cases of #5043 and #5097 to the CI
2025-04-30 20:20:43 +02:00
Laytan Laats d2f8cb1306 adds the cases of #5043 and #5097 to the CI 2025-04-30 20:13:21 +02:00
Laytan Laats 396a18efce fix variable NaN comparisons 2025-04-30 20:04:24 +02:00
Laytan c74f777b1b Merge pull request #5097 from laytan/fix-pointer-alias-type-check
fixes assigning null as a type if it's an alias but the base type is null
2025-04-30 19:54:48 +02:00
Laytan Laats 9fb9382449 fixes assigning null as a type if it's an alias but the base type isn't resolved yet
It's a bit of a band aid fix because the field will get the type of the
alias, not the base type, but that was already the case before #5045 so
it's forward progression.

Closes #5092
Fixes #5061
2025-04-30 19:39:38 +02:00
gingerBill e64bcc7709 Merge pull request #5088 from leecommamichael/master
vendor:wasm/WebGL: Fix incorrect parameter types
2025-04-30 13:24:00 +01:00
Jeroen van Rijn b04a83ce9f Merge pull request #5096 from jdennis9/master
os2: Fix reading directory on Windows sometimes failing to decode a file name following one with exotic unicode characters
2025-04-30 12:10:09 +02:00
Jamie Dennis ff0eac2a71 os2: Use win32_wstring_to_utf8 over win32_utf16_to_utf8 when converting FIND_DATAW to File_Info 2025-04-30 21:38:17 +12:00
Michael Lee 757ae5e270 Merge branch 'odin-lang:master' into master 2025-04-29 17:11:10 -05:00
gingerBill 0de802d388 All N-valued (N>=2) expressions in or_else expressions 2025-04-29 17:39:28 +01:00
Michael Lee 9c5fa073df Update webgl.odin 2025-04-29 10:52:11 -05:00
Jeroen van Rijn 7c294a6e55 Merge pull request #5090 from Barinzaya/cbor-fix-unmarshal-slice-overflow
Fixed CBOR Slice Overflow
2025-04-29 14:34:16 +02:00
Barinzaya 3f5e09a0df Fixed an overflow when decoding a large CBOR slice.
The initial allocation for the slice is limited to prevent untrusted
data from forcing a huge allocation, but then the dynamic array was
created with a capacity of the unlimited length, rather than the actual
capacity of the allocation. This was causing a buffer overrun.
2025-04-29 08:19:43 -04:00
gingerBill 03dcff59e8 Merge pull request #5089 from Lperlind/asan-docs
Document base:sanitizer
2025-04-29 13:19:00 +01:00
Lucas Perlind 4763da4b0d Document base:sanitizer 2025-04-29 19:06:09 +10:00
Michael Lee 808eec8e23 Fix incorrect parameter types 2025-04-28 20:24:41 -05:00
Jeroen van Rijn 4f00224dd2 Add cbor.unmarshal_from_bytes taking a []byte 2025-04-29 01:10:15 +02:00
Jeroen van Rijn 8c47d42394 Fix lru.remove 2025-04-29 00:14:46 +02:00
Jeroen van Rijn 26f1cb493e Merge pull request #5087 from elyalon/typo
Fix typo in private function
2025-04-28 21:25:10 +02:00
Ely Alon 13566306d2 Fix typo in private function 2025-04-28 22:03:20 +03:00
Jeroen van Rijn d463aba7d1 Warn if someone imports the same case-folded path twice 2025-04-27 14:32:26 +02:00
Jeroen van Rijn 7d4c3d23e6 Merge pull request #5079 from herohiralal/master
Pipe size on windows.
2025-04-26 23:05:16 +02:00
Rohan Jadav 80a6f8928a fix: Pipe size on windows. 2025-04-27 01:58:37 +05:30
Laytan Laats 6c1a3c4f0c box2d: fix World_CollideMover 2025-04-25 18:24:41 +02:00
gingerBill f3cc734b39 Add copy_directory 2025-04-25 09:01:53 +01:00
gingerBill b5c658a2cf Merge pull request #5069 from laytan/box2d-3.1.0
box2d: update to 3.1.0
2025-04-25 08:26:43 +01:00
gingerBill 9f30380712 Merge pull request #5072 from Lperlind/asan
Add more asan support to the odin runtime and begin sanitizing allocators
2025-04-25 08:24:18 +01:00
gingerBill b83809779b Merge pull request #5075 from Barinzaya/global-var-alignment
Fix Global/Static Variable Alignment
2025-04-25 08:23:48 +01:00
Barinzaya 9284ebb5e8 Add missing cast to global/static var alignments. 2025-04-24 14:35:00 -04:00