Jake Leahy
6bc52737b3
Make 'field is not accessible' and 'field initialized twice' errors point to the field inside the obj construction ( #24557 )
...
Fixes two line infos to make the error's clearer inside editors
- 'field is not accessible' would point to the whole object construction
instead of just the field inside the construction
- 'field initialized twice' would point to the colon instead of the
field
2024-12-22 14:25:36 +01:00
ringabout
9bb7e53e7f
fixes #22153 ; UB calling allocCStringArray([""]) with --mm:refc ( #24529 )
...
fixes #22153
It's a problem for refc because you cannot index a nil string: i.e.
`[""]` is `{((NimStringDesc*) NIM_NIL)}` which cannot be indexed
2024-12-11 21:02:24 +01:00
metagn
2529f33760
remove inserted derefs for ref object fields when transforming to dot call ( #24498 )
...
fixes #24492
Kind of a goofy way of doing this, but we count how many derefs were
used for the first parameter before calling `builtinFieldAccess`, then
count after, and if there are more now than before, we remove the added
derefs. I thought maybe getting rid of #18298 would simplify it but
maybe this would still be the best way.
For better encapsulation we could make `dotTransformation` take an
`nOrig` param instead but this would be less efficient since it would
need a copy, though `semAsgn` already makes one.
2024-12-04 12:16:37 +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
metagn
a2031ec6cf
remove structural equality check for objects and distinct types ( #24448 )
...
follows up #24425 , fixes #18861 , fixes #22445
Since #24425 generic object and distinct types now accurately link back
to their generic instantiations. To work around this issue previously,
type matching checked if generic objects/distinct types were
*structurally* equal, which caused false positives with types that
didn't use generic parameters in their structures. This structural check
is now removed, in cases where generic objects/distinct types require a
nontrivial equality check, the generic parameters of the `typeInst`
fields are checked for equality instead.
The check is copied from `tyGenericInst`, but the check in
`tyGenericInst` is not always sufficient as this type can be skipped or
unreachable in the case of `ref object`s.
2024-11-18 17:37:47 +01:00
metagn
511ab72342
fix subtype match of generic object types ( #24430 )
...
split from #24425
Matching `tyGenericBody` performs a match on the last child of the
generic body, in this case the uninstantied `tyObject` type. If the
object contains no generic fields, this ends up being the same type as
all instantiated ones, but if it does, a new type is created. This fails
the `sameObjectTypes` check that subtype matching for object types uses.
To fix this, also consider that the pattern type could be the generic
uninstantiated object type of the matched type in subtype matching.
2024-11-12 14:31:59 +01:00
metagn
4091576ab7
implement generic default values for object fields ( #24384 )
...
fixes #21941 , fixes #23594
2024-10-30 08:58:04 +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
6d6489a9ab
fixes requiresInit for var statements without initialization ( #24177 )
...
ref https://forum.nim-lang.org/t/12530
2024-09-26 06:28:40 +02: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
Jason Beetham
6c4e7835bf
When in object handles procedure call again, fixes #22474 ( #22480 )
...
Ping @narimiran please backport to the 2.0 line.
2023-08-15 17:48:31 +02:00
ringabout
1c2ccfad08
fixes #22301 ; fixes #22324 ; rejects branch initialization with a runtime discriminator with defaults ( #22303 )
...
* fixes #22301 ; rejects branch initialization with a runtime discriminator with defaults
* undefault nimPreviewRangeDefault
* fixes tests
* use oldCheckDefault
2023-07-25 12:08:32 +02:00
ringabout
f524d60fa1
fixes #22123 ; Compiler bug with default initializer values and arrays ( #22128 )
2023-06-20 08:02:06 +02:00
Juan M Gómez
b4d9be0f8a
fixes ilegal recursion ( #22105 )
2023-06-16 08:23:25 +02:00
Juan M Gómez
d90581c677
Allows for arbitrary ordering of inheritance in type section #6259 ( #22070 )
...
* Allows for arbitrary ordering of inheritance in type section #6259
* prevents ilegal recursion
* fixes ilegal recursion. Test passes with a better message
* Apply suggestions from code review
---------
Co-authored-by: Andreas Rumpf <rumpf_a@web.de >
2023-06-15 09:56:08 +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
3575f2bf9c
fix #20972 fixes invalid and UB codegen case object transitions for both refc and ORC [backport] ( #21611 )
...
fix #20972 fixes invalid and UB codegen case object transitions for refc and ORC
2023-04-04 12:18:43 +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
1707bc4a99
fixes #20856 ; store defaults directly ( #20859 )
...
* fixes #20856 ; store defaults directly
* fixes
* fixes
* check
* fixes
2022-11-17 09:38:50 +08:00
Derek 呆
de89f6ce32
add more test for #20836 ( #20842 )
2022-11-14 13:49:11 -05: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
ringabout
d901d3b8c5
fixes #20836 ; fixes #20833 ; fixes unsafeNew ( #20841 )
...
* fixes #20836 ; fixes `unsafeNew`
* fixes #20833
2022-11-14 15:59:37 +01: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
27896ed469
fixes type check of ranges for default fields ( #20660 )
2022-10-27 17:23:33 +02:00
ringabout
c1343739e1
add type check for default fields ( #20652 )
2022-10-25 07:39:57 +02:00
ringabout
d954e698b3
Automatic dereferencing is removed ( #20531 )
2022-10-10 15:02:23 +02: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
Bung
0769b160c5
less test time costs ( #20479 )
2022-10-02 06:42:41 +02:00
ringabout
7739e23420
defaults to ORC ( #19972 )
...
* defaults to Orc
* bootstrap using refc
* use gc
* init orc defines
* unregister orc
* fix gc
* fix commands
* add prepareMutation for orc
* enable deepcopy for orc
* prepareMutation
* more fixes
* some cases
* bug #20081
* partial fixes
* partial fixes
* fixes command line
* more fixes
* build Nim with refc
* use gc
* more fixes
* rstore
* orc doesn't support threadpool
* more shallowCopy
* more fixes
* fixes unsafeNew
* workarounds
* small
* more fixes
* fixes some megatest
* tcodegenbugs1 refc
* fxies megatest
* build nimble with refc
* workaround tensordsl tests
* replace shallowCopy with move
* fixes action
* workaround
* add todo
* fixes important packages
* unpublic unregisterArcOrc
* fixes cpp
* enable windows
Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com >
2022-09-23 13:05:05 +02:00
metagn
86f7f4ffa5
remove deprecated type pragma syntax, fix bugs that required it ( #20199 )
...
* remove deprecated pragma syntax from 0.20.0
closes #4651 , closes #16653 with a cheap fix for now due to
how early `tfFinal` is set
* remove type pragma between name and generics
* undo removal, try removing bind expression (0.8.14)
* fix test, unremove bind expr
* remove again
* Update changelog.md
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com >
* dependencies @ HEAD & weave test dependencies
* try fix package ci
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com >
2022-09-03 09:52:13 +02:00
flywind
0c3892c3c7
nvro don't touch cdecl types [backport: 1.6] ( #19461 )
...
* nvro don't touch cdecl types; fix #19342 again
2022-01-28 09:53:42 +01:00
flywind
9b9ae8a487
nrvo shouldn't touch bycopy object[backport:1.2] ( #19385 )
...
fix nim-lang#19342
2022-01-14 00:39:17 +08:00
Saem Ghani
c6dc9c0255
fixes #17437 - crash where error reporting > 1 ( #17547 )
...
* fixes #17437
* Fix bug reference comment
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com >
* [skip ci] describe why we have hasError
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com >
2021-03-29 12:48:00 +02:00
flywind
271f68259b
remove some noises in tests ( #16448 )
2020-12-27 14:45:57 +01:00
Timothee Cour
7e1ae35195
testament: error instead of silently ignore invalid targets; remove pointless alias target vs targets; document matrix; DRY ( #16343 )
...
* testament: error instead of silently ignore invalid targets
* s/target/targets/
* fix test; refs #16344
* address comments
* Update testament/specs.nim
Co-authored-by: Andreas Rumpf <rumpf_a@web.de >
2020-12-14 10:58:29 +01:00
Timothee Cour
b809562c7c
make megatest consistent with unjoined tests wrt newlines, honor newlines in output spec ( #16151 )
...
* fix megatest newlines
* still allow missing trailing newline for now but in a more strict way than before
2020-11-28 09:09:31 +01:00
flywind
35f8803250
close #4318(add testcase for #4318 ) ( #15904 )
...
* close #4318(add testcase for #4318 )
* Update tests/objects/t4318.nim
Co-authored-by: Juan Carlos <juancarlospaco@gmail.com >
Co-authored-by: Juan Carlos <juancarlospaco@gmail.com >
2020-11-11 10:29:17 +08:00