-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Nim 2.0.2 regression: macros.getType(…).kind of object type is nnkBracketExpr (was nnkObjectTy in Nim 2.0.0) #23112
Labels
Comments
Let's try this bisecting feature. !nim c import macros
type
Container = object
foo: string
proc canBeImplicit(t: typedesc): string {.compileTime.} =
## returns empty string if type can be implicit, else the reason why it can't
let tDesc = getType(t)
if tDesc.kind != nnkObjectTy: return "type is not an object, but a " & $tDesc.kind
return ""
const res = canBeImplicit(Container)
assert len(res) == 0, "unexpected error for canBeImplicit: " & res |
!nim c import macros
type
Container = object
foo: string
proc canBeImplicit(t: typedesc): string {.compileTime.} =
## returns empty string if type can be implicit, else the reason why it can't
let tDesc = getType(t)
if tDesc.kind != nnkObjectTy: return "type is not an object, but a " & $tDesc.kind
return ""
const res = canBeImplicit(Container)
assert len(res) == 0, "unexpected error for canBeImplicit: " & res |
import macros
type
Container = object
foo: string
proc canBeImplicit(t: typedesc): string {.compileTime.} =
let tDesc = getType(t)
echo tDesc.treeRepr
const res = canBeImplicit(Container)
An easy workaround is: var tDesc = getType(t)
while tDesc.kind == nnkBracketExpr and tDesc[0].eqIdent"typeDesc":
tDesc = getType(tDesc[1]) Caused by #22581, hence this test change. |
metagn
added a commit
to metagn/Nim
that referenced
this issue
Dec 22, 2023
fixes nim-lang#23112, fixes a mistake in nim-lang#22581
metagn
added a commit
to metagn/Nim
that referenced
this issue
Dec 22, 2023
Araq
pushed a commit
that referenced
this issue
Jan 18, 2024
narimiran
pushed a commit
that referenced
this issue
Jan 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
getType
frommacros
returns annnkBracketExpr
for an object type with Nim 2.0.2 where Nim 2.0.0 returned annnkObjectTy
:Nim Version
Nim 2.0.2 on macOS, Linux and Window, see CI run of the test above
Current Output
Expected Output
Possible Solution
No response
Additional Information
This breaks NimYAML, specifically its implicit pragma. NimYAML callers that do not use this feature are not affected.
The text was updated successfully, but these errors were encountered: