mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-16 08:04:20 +00:00
Fix range type construction in the VM (#9205)
The `range[X,Y]` representation is wrong, we use `range[X .. Y]`
instead.
Fixes #9194
(cherry picked from commit 8a1055adce)
This commit is contained in:
20
tests/macros/t9194.nim
Normal file
20
tests/macros/t9194.nim
Normal file
@@ -0,0 +1,20 @@
|
||||
discard """
|
||||
output: '''
|
||||
range[0 .. 100]
|
||||
array[0 .. 100, int]
|
||||
'''
|
||||
"""
|
||||
|
||||
import macros
|
||||
|
||||
type
|
||||
Foo1 = range[0 .. 100]
|
||||
Foo2 = array[0 .. 100, int]
|
||||
|
||||
macro get(T: typedesc): untyped =
|
||||
# Get the X out of typedesc[X]
|
||||
let tmp = getTypeImpl(T)
|
||||
result = newStrLitNode(getTypeImpl(tmp[1]).repr)
|
||||
|
||||
echo Foo1.get
|
||||
echo Foo2.get
|
||||
Reference in New Issue
Block a user