Commit Graph

1035 Commits

Author SHA1 Message Date
LeandroLibanio28H
7b612a3a15 Checking if entity is exported before checking if it's a procedure group 2025-06-02 20:14:19 -03:00
Feoramund
57019f199c Add suggestions for quaternionN or complexN conversions
Quaternions and complex numbers are constructed with `quaternion` and
`complex`, but their types are of the `*N` form.

These suggestions should point the user in the right direction.
2025-05-31 07:09:29 -04:00
gingerBill
594f1b30b4 Add Suggestion: 'context = runtime.default_context()' 2025-05-24 14:18:16 +01:00
Jeroen van Rijn
95183e4b9c Remove now unnecessary checks. 2025-05-21 19:37:09 +02:00
Jeroen van Rijn
96fd07e0ee Fix #5177 - Tweak error messages. 2025-05-21 19:20:58 +02:00
Jeroen van Rijn
ab95932502 -dynamic-literals 2025-05-19 20:44:27 +02: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
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
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
0de802d388 All N-valued (N>=2) expressions in or_else expressions 2025-04-29 17:39:28 +01:00
gingerBill
d3f0b31fcc Improve or_else type inference logic 2025-03-27 15:08:53 +00:00
gingerBill
7f61e53286 Fix #3955 2025-03-07 10:48:49 +00:00
gingerBill
97eeb25adc Fix #4244 2025-03-07 10:44:34 +00:00
gingerBill
97d410c2ae Fix #4909 2025-03-06 11:17:55 +00:00
Barinzaya
6e3d17d189 Fixed ~ on bit_set[Some_Enum] altering the definition of the enum.
This was occurring for enums whose minimum values were greater than
zero.
2025-03-02 13:29:39 -05:00
gingerBill
748a771dad Allow indirection for swizzling on procedure parameters 2025-02-21 12:38:40 +00:00
gingerBill
99d91ccd31 Work on making name mangling deterministic 2025-02-17 11:32:49 +00:00
gingerBill
f80bea5b11 Remove transmute suggestion with -vet-cast when transmuting native <-> endian-specific types 2025-02-05 10:27:17 +00:00
gingerBill
05a2d1bfbf Fix #4750 2025-01-31 09:34:38 +00:00
David Rubin
5951c25f71 fix inverted error messages 2025-01-18 02:04:35 -08:00
flysand7
3f20b63243 Error if -no-thread-local is used in presence of -no-crt on Unix 2025-01-17 02:51:22 +03:00
flysand7
4f0206ce08 Added compile-time checks for thread locals with -no-crt
Now using any thread-local variables with -no-crt enabled
will cause a compiler error, unless -no-thread-local is
given.

Also fixed a minor typo in a comment.
2025-01-17 01:12:23 +03:00
gingerBill
3d8bde9549 Merge pull request #4601 from Barinzaya/simd_vector_broadcasting
Implicit broadcasting for SIMD arrays
2025-01-06 11:15:28 +00:00
gingerBill
bca08d3b85 Make -no-dynamic-literals the default now 2025-01-05 13:33:06 +00:00
gingerBill
2efe4c2d68 Add #+feature dynamic-literals 2025-01-05 13:19:10 +00:00
gingerBill
7b334d2bd9 Add #branch_location 2025-01-01 17:26:15 +00:00
Barinzaya
14216ebf51 Added some implicit broadcasting for #simd arrays.
This covers broadcasting from untyped numbers when assigning, as well as
when performing binary operations. SIMD intrinsics have not been
adjusted
2024-12-19 20:07:04 -05:00
gingerBill
65de0256ce Fix #4535 2024-12-02 15:57:08 +00:00
Jeroen van Rijn
6d83755e92 Fix assert when return value expected. 2024-11-28 20:44:57 +01:00
Laytan Laats
83bf0c6ab8 checker: only error with -vet-cast when it is actually castable 2024-11-21 19:18:17 +01:00
gingerBill
e38a08013e Remove #relative types from the compiler 2024-11-14 16:17:24 +00:00
gingerBill
f02d621a8e Merge pull request #4394 from seventh-chord/errormessages
Suggestion when assigning enum to bit_set
2024-11-06 13:10:17 +00:00
gingerBill
a0b35f67f8 Fix previous commit for arrays 2024-11-04 12:51:54 +00:00
gingerBill
bbf76fa43e Fix bug for foo().bar where foo() is a 0-value expression 2024-11-04 12:49:43 +00:00
gingerBill
f32e27d2e4 Fix bug caused due to incorrect type checking looking for context not defined in a context 2024-10-27 11:10:55 +00:00
Morten Hauke Solvang
7f4ce2e179 Suggestion when assigning enum to bit_set 2024-10-19 10:25:56 +02:00
gingerBill
417e9bb37f Fix #4373 2024-10-13 22:26:04 +01:00
Laytan Laats
3ff887c6b6 fix not erroring on invalid ternary
For example: `a: f32 = true ? 1 : len` would get to the back-end without
errors.

Fixes #1690
2024-10-02 15:55:46 +02:00
Feoramund
acbf5c8d97 Forbid labelled or-branch expressions within defer 2024-09-19 05:59:37 -04:00
Laytan Laats
603efa860a add '#caller_expression' 2024-09-14 22:13:37 +02:00
gingerBill
3166c7bef9 Add Suggested Example for using an inline procedure which enables a target feature 2024-09-12 10:07:09 +01:00
Laytan Laats
387f56634d fix reuse of slice for varargs with poly types 2024-09-12 02:25:44 +02:00
gingerBill
27ed10746d Allow transmute(Bit_Set)~T(0) 2024-09-11 23:08:38 +01:00
gingerBill
9b06ea5bfd Fix #4229 for edge case os.Error/os.Errno legacy bodge 2024-09-11 12:01:01 +01:00
Jeroen van Rijn
564c7821c5 Allow ExactValue_Invalid in assert.
Fixes #4225
2024-09-10 15:19:12 +02:00
Feoramund
9871ad5fc8 Remove extra format item at end of context error message 2024-09-01 17:50:50 -04:00
gingerBill
b4bdb73158 Fix new(sync.Mutex) 2024-08-31 15:06:20 +01:00
gingerBill
476030dd28 Fix #4156 2024-08-31 13:51:35 +01:00
gingerBill
38ea276231 Make ~some_bit_set work on only the possible bits by doing a mask with the full set 2024-08-30 10:48:21 +01:00