-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Nim Version
Nim Compiler Version 2.2.4 [Linux: amd64]
Compiled at 2025-04-22
Copyright (c) 2006-2025 by Andreas Rumpf
git hash: f7145dd
active boot switches: -d:release
Description
#!/bin/env -S nim -f r
#
type
TRange = range[-5 .. 5]
let b = (0.TRange, 0.TRange)
assert b[0] == 0
assert b[1] == 0
assert 0 == b[0]
assert 0 == b[1]
assert (0,0) == b
# Commenting out the following line allows the compilation to work
# but with the line uncommented the compilation fails
assert b == (0,0)
Current Output
Hint: used config file '/home/ggb/.choosenim/toolchains/nim-2.2.4/config/nim.cfg' [Conf]
Hint: used config file '/home/ggb/.choosenim/toolchains/nim-2.2.4/config/config.nims' [Conf]
.....................................................................
/home/ggb/Temp/nim/temp/test_alias.nim(15, 10) Error: type mismatch
Expression: b == (0, 0)
[1] b: (TRange, TRange)
[2] (0, 0): (int, int)
Expected one of (first mismatch at [position]):
[1] proc `==`(x, y: bool): bool
[1] proc `==`(x, y: char): bool
[1] proc `==`(x, y: cstring): bool
[1] proc `==`(x, y: float): bool
[1] proc `==`(x, y: float32): bool
[1] proc `==`(x, y: int): bool
[1] proc `==`(x, y: int16): bool
[1] proc `==`(x, y: int32): bool
[1] proc `==`(x, y: int64): bool
[1] proc `==`(x, y: int8): bool
[1] proc `==`(x, y: pointer): bool
[1] proc `==`(x, y: string): bool
[1] proc `==`(x, y: uint): bool
[1] proc `==`(x, y: uint16): bool
[1] proc `==`(x, y: uint32): bool
[1] proc `==`(x, y: uint64): bool
[1] proc `==`(x, y: uint8): bool
[1] proc `==`[Enum: enum](x, y: Enum): bool
[1] proc `==`[I, T](x, y: array[I, T]): bool
[1] proc `==`[T: proc | iterator](x, y: T): bool
[1] proc `==`[T](x, y: openArray[T]): bool
[1] proc `==`[T](x, y: ptr T): bool
[1] proc `==`[T](x, y: ref T): bool
[1] proc `==`[T](x, y: seq[T]): bool
[1] proc `==`[T](x, y: set[T]): bool
[2] proc `==`[T: tuple | object](x, y: T): bool
Expected Output
Known Workarounds
No response
Additional Information
No response
Metadata
Metadata
Assignees
Labels
No labels