-
-
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
distinctBase matching regression #22417
Comments
!nim c import std/typetraits
type A = int
var v: A
distinctBase v = 42 |
@ringabout (member) devel 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("typetraits")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("A"),
newEmptyNode(),
newIdentNode("int")
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("v"),
newIdentNode("A"),
newEmptyNode()
)
),
nnkCommand.newTree(
newIdentNode("distinctBase"),
nnkExprEqExpr.newTree(
newIdentNode("v"),
newLit(42)
)
)
) stable 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("typetraits")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("A"),
newEmptyNode(),
newIdentNode("int")
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("v"),
newIdentNode("A"),
newEmptyNode()
)
),
nnkCommand.newTree(
newIdentNode("distinctBase"),
nnkExprEqExpr.newTree(
newIdentNode("v"),
newLit(42)
)
)
) 2.0.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("typetraits")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("A"),
newEmptyNode(),
newIdentNode("int")
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("v"),
newIdentNode("A"),
newEmptyNode()
)
),
nnkCommand.newTree(
newIdentNode("distinctBase"),
nnkExprEqExpr.newTree(
newIdentNode("v"),
newLit(42)
)
)
) 1.6.0 👍 |
a more meaningful version, ie |
Why was the issue edited to the
|
it doesn't work, the problem here is not related to the type definition, the matched
|
Yes. That is new parser behavior in 2.0. From the changelog:
Maybe the "porting guide" was not comprehensive enough. |
so this is expected behavior, not a issue now. |
@arnetheduck Any further problems? |
weird but ok, whatever. I think the most accurate summary of the change is "command syntax has many weird quirks, avoid it" - ie when you see consider:
x = 44 in the above case is not an expression: the function will return 0 which means that assignment only "sometimes" exhibits expression properties - if this change was made, the above should reasonably also see expression treatment and turn into a return value for Closing for now, this bug is probably not the right place for this discussion, though it's certainly an oddball change that broke compat. |
Read nim-lang/RFCs#442 for reasoning |
Description
Nim Version
works in 1.6, fails in 2.0
Current Output
No response
Expected Output
No response
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: