-
-
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
regression that std/json
seq[JsonNode]
==
operator raises exception only in Nim 2.0+
#22254
Comments
!nim c import std/json
proc f(a, b: seq[JsonNode]) {.raises: [].} = discard a == b |
@juancarlospaco (contributor) devel :-1: FAILOutput
Stats
IRASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("json")
)
),
nnkProcDef.newTree(
newIdentNode("f"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
newIdentNode("b"),
nnkBracketExpr.newTree(
newIdentNode("seq"),
newIdentNode("JsonNode")
),
newEmptyNode()
)
),
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("raises"),
nnkBracket.newTree(
)
)
),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
nnkInfix.newTree(
newIdentNode("=="),
newIdentNode("a"),
newIdentNode("b")
)
)
)
)
) stable :+1: OKOutput
Stats
1.6.0 :+1: OKOutput
Stats
1.4.0 :+1: OKOutput
Stats
1.2.0 :+1: OKOutput
Stats
1.0.0 :+1: OKOutput
Stats
0.20.2 :+1: OKOutput
Stats
#1e15f975b ➡️ 🐛Diagnosticsringabout introduced a bug at
The bug is in the files:
The bug can be in the commits: (Diagnostics sometimes off-by-one). 1 minute bisecting 1580 commits at 1336 commits per second.
|
My guess is that it's equivalent to type
G = object
case kind: bool
of false: discard
of true: elems: seq[G]
func `==`(a, b: G): bool =
case a.kind
of false: true
of true: a.elems == b.elems
proc f*(a, b: G) {.raises: [].} = discard a == b which is a simplified case -- but has the same properties where it regresses from 1.6 to 2.0/devel. Somewhat to my surprise, it didn't have anything to do with the |
Description
Nim Version
version-2-0
:devel
:Current Output
Expected Output
Possible Solution
No response
Additional Information
Related to #22253 but distinct in that this behaves differently in 1.6.14 and 2.0/devel, while that one behaves consistently across all of 1.6.14, 2.0, and devel, so some additional distinct mechanism is presumably operating in this case.
The text was updated successfully, but these errors were encountered: