fixes#24847
Object constructors call `fillObjectFields` when a field inside the
constructor does not have a location, however when the field is from a
base type this does not process it. Now `fillObjectFields` also calls
itself for the base type to fix this but not sure if this is a good
solution as `fillObjectFields` is used in other places too.
(cherry picked from commit a625fab098)
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
(cherry picked from commit 6bc52737b3)
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
(cherry picked from commit 9bb7e53e7f)
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.
(cherry picked from commit 2529f33760)
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.
(cherry picked from commit a2031ec6cf)
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.
(cherry picked from commit 511ab72342)
* 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
* fixes#22301; rejects branch initialization with a runtime discriminator with defaults
* undefault nimPreviewRangeDefault
* fixes tests
* use oldCheckDefault
* 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>
* 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
* 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>