Skip to content

Commit

Permalink
exprStructuralEquivalentStrictSymAndComm: Don't ignore nkType type eq…
Browse files Browse the repository at this point in the history
…uality
  • Loading branch information
Clyybber committed Mar 15, 2024
1 parent 9549d7e commit 06f6310
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/ast/trees.nim
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ makeTreeEquivalenceProc(exprStructuralEquivalentStrictSymAndComm,
symCheck = a.sym == b.sym,
floatCheck = sameFloatIgnoreNan(a.floatVal, b.floatVal),
typeCheck = true,
typeCheck = a.typ == b.typ,
commentCheck = a.comment == b.comment
)
export exprStructuralEquivalentStrictSymAndComm

Check failure on line 104 in compiler/ast/trees.nim

View workflow job for this annotation

GitHub Actions / Build release binaries (macOS (M1))

cannot export: exprStructuralEquivalentStrictSymAndComm

Check failure on line 104 in compiler/ast/trees.nim

View workflow job for this annotation

GitHub Actions / Build release binaries (Linux)

cannot export: exprStructuralEquivalentStrictSymAndComm

Check failure on line 104 in compiler/ast/trees.nim

View workflow job for this annotation

GitHub Actions / Build release binaries (macOS)

cannot export: exprStructuralEquivalentStrictSymAndComm

Check failure on line 104 in compiler/ast/trees.nim

View workflow job for this annotation

GitHub Actions / Build release binaries (Windows)

cannot export: exprStructuralEquivalentStrictSymAndComm
Expand Down
20 changes: 20 additions & 0 deletions tests/lang_callable/macros/tmacros_various.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Infix
macrocache ok
CommentStmt "comment 1"
CommentStmt "comment 2"
false
'''
output: '''
Expand Down Expand Up @@ -346,3 +347,22 @@ block:
static:
echo treeRepr(C1[1])
echo treeRepr(C2[1])

block:
# Ensure nkType equality is not ignored by `==` for NimNode
macro checkEq(a, b: typed) =
echo a == b

type Exception1 = object of Exception
type Exception2 = object of Exception
checkEq (;
try:
discard
except Exception1:
discard
), (;
try:
discard
except Exception2:
discard
)

0 comments on commit 06f6310

Please sign in to comment.