-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sem): issues with method-call syntax in templates #1298
fix(sem): issues with method-call syntax in templates #1298
Commits on May 3, 2024
-
semtempl: simpler
nkExprEqExpr|nkExprColonExpr
handlingInstead of going through the `semTemplBody` indirection, directly check whether the name part can be substituted with a template parameter. This also prevents non-gensyms from being bound in the name position.
Configuration menu - View commit details
-
Copy full SHA for 287b5ad - Browse repository at this point
Copy the full SHA 287b5adView commit details -
semtempl: split
nkAccQuoted
handling fromnkDotExpr
Using a dedicated branch requires less conditionals, and prepares for changing the dot expression handling. Except for the edge case where a quoted symbol choice (which is nonsense anyway) is inserted into a template body by a macro, the behaviour stays the same.
Configuration menu - View commit details
-
Copy full SHA for 1a26052 - Browse repository at this point
Copy the full SHA 1a26052View commit details -
semtempl: clean up
nkDotExpr
handlingMove the not-a-qualified-symbol handling into the `if s.isNil` branch.
Configuration menu - View commit details
-
Copy full SHA for 0b03eb7 - Browse repository at this point
Copy the full SHA 0b03eb7View commit details -
semtempl: always bind gensyms in field positions
This lifts the restriction that a gensym'ed symbol cannot be used in a field access position. However, at the moment, it also causes symbols such as `skVar` symbols to be bound there, which is incorrect. Since gensyms don't reach into `semTemplSymbol` anymore, all conditionals including them become false and are thus obsolete.
Configuration menu - View commit details
-
Copy full SHA for 1d08c4a - Browse repository at this point
Copy the full SHA 1d08c4aView commit details -
semtempl: only consider a subset of symbols in field positions
Only routine symbols and type / generic parameter symbols are considered in field access positions, addressing the problem that symbols of, e.g., locals blocked other symbols. Symbol binding in generics for dot expressions works similar, with the differences that: * types and generic parameters are not considered there * a *closed* symbol choice is forced, instead of an *open* one Using an open symbol choice is wrong (it violates the specification), but is required for backwards compatibility.
Configuration menu - View commit details
-
Copy full SHA for fd240c1 - Browse repository at this point
Copy the full SHA fd240c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for b9ffc79 - Browse repository at this point
Copy the full SHA b9ffc79View commit details -
* rename `isField` to the more imperative `noGenSyms` * fix gensyms being added to the symbol choice, even if disabled (the flags of `s` were tested, not those of `a`)
Configuration menu - View commit details
-
Copy full SHA for 40d2602 - Browse repository at this point
Copy the full SHA 40d2602View commit details -
semexprs: workaround gensyms in dot expressions
It's now possible that the field part of a dot expression is a identifier coming from a gensym. For example: ```nim template t(x: int) = type Typ {.gensym.} = float x.Typ ``` So that field access still works in this case, `builtinFieldAccess` and `propertyWriteAccess` strip the identifier off of the gensym prefix first.
Configuration menu - View commit details
-
Copy full SHA for d417b78 - Browse repository at this point
Copy the full SHA d417b78View commit details -
manual: remove mention of the template lookup bugs
The `x.T` syntax now works when `T` is a gensym'ed symbos.
Configuration menu - View commit details
-
Copy full SHA for a9988f0 - Browse repository at this point
Copy the full SHA a9988f0View commit details -
The `knownIssue` test is for a bug that's pre-existing.
Configuration menu - View commit details
-
Copy full SHA for 2276e2b - Browse repository at this point
Copy the full SHA 2276e2bView commit details -
fix
tcustom_numeric_literals
testThe field part of a dot expression may now be a symbol choice, which interferes with rendering of custom numeric literals (e.g., `1'lit`), where the special rendering was only enabled for `nkIdent` and `nkSym` nodes. To keep the test working, `getPIdent` (which is used by `isCustomLit`) now also returns the identifier for symbol-choice nodes.
Configuration menu - View commit details
-
Copy full SHA for 137c8a7 - Browse repository at this point
Copy the full SHA 137c8a7View commit details
Commits on May 4, 2024
-
Revert "fix
tcustom_numeric_literals
test"This reverts commit 137c8a7.
Configuration menu - View commit details
-
Copy full SHA for aa4d1f5 - Browse repository at this point
Copy the full SHA aa4d1f5View commit details -
fix the
tcustom_numeric_lit
test properlyJust retrieving the identifier from the symbol choice doesn't work, since then the symbol-choice node is passed to `gident`, where `atom` then crashes because symbol-choices are not allowed (a symbol-choice is, not necessarily, an atom, so this is correct). Instead of `getPIdent` retrieving an identifier from a symbol-choice, `isCustomLit` now special-cases symbol-choices.
Configuration menu - View commit details
-
Copy full SHA for 66a51ee - Browse repository at this point
Copy the full SHA 66a51eeView commit details
Commits on May 5, 2024
-
semtempl: merge
nkDotExpr
/nkAccQuoted
handlingThis restores the previous behaviour of quoted identifiers with regards to symbol binding of (they ignore injected symbols, for whatever reason).
Configuration menu - View commit details
-
Copy full SHA for 9a1cca9 - Browse repository at this point
Copy the full SHA 9a1cca9View commit details