ringabout
e9a0c9634e
fixes #25784 ; Object default field initialized with an object constructor ( #25785 )
...
fixes #25784
This pull request addresses the handling of forward object types during
type determination in the Nim compiler and adds new test cases to ensure
correct default value initialization for objects with forward
references. The main focus is to allow forward object types to remain
unresolved during the initial type analysis, deferring their resolution
to a later compilation phase. This helps support object constructors
with default values involving forward types.
**Compiler improvements:**
* Updated `semObjConstr` in `compiler/semobjconstr.nim` to allow forward
object types (`tyForward`) to remain unresolved during determine-type
analysis. This avoids premature errors and ensures that such types are
resolved later, supporting delayed field-default resolution.
**Testing enhancements:**
* Added new test cases in `tests/objects/mobject_default_value.nim` to
verify that objects with default fields referencing forward types are
correctly initialized, and that their default values are properly set.
---------
Co-authored-by: Copilot <copilot@github.com >
2026-05-05 21:05:17 +02:00
Andreas Rumpf
f62669a5d5
Yrc typos and omissions ( #25500 )
2026-02-10 13:21:35 +01:00
ringabout
d54b5f3ae1
fixes #25252 ; Unexpected ambiguous call with fields over object with default fields ( #25256 )
...
fixes #25252
2025-11-04 20:08:07 +08:00
ringabout
73112d64a3
fixes #24793 ; Revert "remove special treatments of sinking const sequences ( #24812 )
...
fixes #24793
There doesn't seem to have a better solution
2025-03-26 23:49:00 +08:00
ringabout
2df633180a
enable experimental:strictDefs ( #24225 )
2024-11-23 22:01:39 +01:00
ringabout
9fcc3b0599
adds a test case ( #24466 )
...
closes https://github.com/nim-lang/Nim/issues/23770 ref
https://github.com/nim-lang/Nim/pull/24442
2024-11-21 22:10:48 +01:00
ringabout
815bbf0e73
fixes #23545 ; C compiler error when default initializing an object field function ( #24375 )
...
fixes #23545
2024-10-29 08:08:35 +01:00
ringabout
ac0179ced9
fixes #23943 ; simple default value for range ( #23996 )
...
fixes #23943
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de >
2024-08-22 07:20:00 +02:00
ringabout
e96fad1eed
fixes default float ranges ( #23957 )
2024-08-16 15:50:31 +02:00
ringabout
a33e2b76ae
supports default for range types using firstOrd with nimPreviewRangeDefault ( #23950 )
...
ref https://github.com/nim-lang/Nim/issues/23943
2024-08-13 17:08:30 +02:00
ringabout
96513b2506
fixes #22926 ; Different type inferred when setting a default value for an array field ( #22999 )
...
fixes #22926
2023-11-29 10:36:20 +01:00
ringabout
affd3f7858
fixes #22613 ; Default value does not work with object's discriminator ( #22614 )
...
* fixes #22613 ; Default value does not work with object's discriminator
fixes #22613
* merge branches
* add a test case
* fixes status
* remove outdated comments
* move collectBranchFields into the global scope
2023-09-01 08:55:19 +02:00
ringabout
f524d60fa1
fixes #22123 ; Compiler bug with default initializer values and arrays ( #22128 )
2023-06-20 08:02:06 +02:00
ringabout
9c40dd2406
fixes #21840 ; nested local template lookup regression ( #21841 )
...
* fixes #21840 ; nested local template lookup regression
* use original types
* fixes js vm tests
2023-05-12 19:38:10 +08:00
ringabout
ebdff1c7d3
fixes #21801 ; object field initialization with overloaded functions ( #21805 )
...
* fixes #21801 ; object field initialization with overloaded functions
* use the correct type
2023-05-08 13:52:28 +02:00
ringabout
0319824322
fixes #21023 ; Segfault when mixing seqs, orc, variants and futures ( #21497 )
...
* fixes #21023 ; Segfault when mixing seqs, orc, variants and futures
* fixes none of the branches were explicitly selected
* add one more test
* one more test
2023-03-10 09:28:51 +01:00
ringabout
bbb6d2c69d
fixes #20695 ; fixes object with distinct defaults and tables ( #21428 )
2023-02-24 09:02:44 +01:00
ringabout
55373e65b4
unpublic arrayWith and rename it to nimArrayWith ( #21006 )
...
* unpublic arrayWith
* unindent
2022-12-04 15:39:14 +08:00
ringabout
7f2ff909d9
fixes object default fields bugs and add tests ( #20839 )
...
* fixes object default fields bugs and add tests
* Update compiler/semmagic.nim
* Update compiler/sem.nim
* Update compiler/sem.nim
Co-authored-by: Andreas Rumpf <rumpf_a@web.de >
2022-11-15 00:31:06 +08:00
Andreas Rumpf
165d523edf
Revert "fixes #20699 ; generate an empty struct for void type" ( #20806 )
...
* Revert "fixes #20699 ; generate an empty struct for void type (#20790 )"
This reverts commit 8fcb9380f0 .
* better fix [backport]
2022-11-12 22:56:40 +01:00
Aditya Siram
8fcb9380f0
fixes #20699 ; generate an empty struct for void type ( #20790 )
...
* fixes #20699 ; generate an empty struct for void type
* Add docs and test case.
2022-11-09 20:15:06 +01:00
ringabout
c4e5dab419
fixes #20740 ; fixes pre-existing field visibility issues and removes efSkipFieldVisibilityCheck ( #20741 )
...
fixes #20740 pre-existing field visibility and refactoring
2022-11-03 15:46:16 +08:00
ringabout
39f925b95d
fixes #20715 ; range[a..b] inside object variant fails ( #20716 )
...
* fixes #20715 ; range[a..b] inside object variant fails
* step one fix
* better fix
* fixes private fields
* mistake
2022-10-31 18:42:45 +01:00
ringabout
141abb7b75
fixes #20681 ; add efSkipFieldVisibilityCheck to skip check ( #20639 )
...
* don't sem const objectConstr defaults
* fixes
* add `efSkipFieldVisibilityCheck`; fixes nkBracket types
* fixes #20681
* fixes tests
* suggestion from @metagn
* fixes tests
Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com >
2022-10-28 16:19:40 -04:00
ringabout
079363bfc3
remove implicit let/var default initialization ( #20508 )
2022-10-07 07:49:27 +02:00
ringabout
f89ba2c951
add default field support for object in ARC/ORC ( #20480 )
...
* fresh start
* add cpp target
* add result support
* add nimPreviewRangeDefault
* reduce
* use orc
* refactor common parts
* add tuple support
* add testcase for tuple
* cleanup; fixes nimsuggest tests
* there is something wrong with cpp
* remove
* add support for seqs
* fixes style
* addd initial distinct support
* remove links
* typo
* fixes tuple defaults
* add rangedefault
* add cpp support
* fixes one more bugs
* add more hasDefaults
* fixes ordinal types
* add testcase for #16744
* add testcase for #3608
* fixes docgen
* small fix
* recursive
* fixes
* cleanup and remove tuple support
* fixes nimsuggest
* fixes generics procs
* refactor
* increases timeout
* refactor hasDefault
* zero default; disable i386
* add tuples back
* fixes bugs
* fixes tuple
* add more tests
* fix one more bug regarding tuples
* more tests and cleanup
* remove messy distinct types which must be initialized by original types
* add tests
* fixes zero default
* fixes grammar
* fixes tests
* fixes tests
* fixes tests
* fixes comments
* fixes and add testcase
* undo default values for results
Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com >
2022-10-04 12:45:10 +02:00