mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 14:55:24 +00:00
resolve local symbols in generic type call RHS (#22610)
resolve local symbols in generic type call fixes #14509
This commit is contained in:
16
tests/generics/m14509.nim
Normal file
16
tests/generics/m14509.nim
Normal file
@@ -0,0 +1,16 @@
|
||||
import macros
|
||||
|
||||
type float32x4 = array[4, float32]
|
||||
type float32x8 = array[8, float32]
|
||||
|
||||
{.experimental: "dynamicBindSym".}
|
||||
macro dispatch(N: static int, T: type SomeNumber): untyped =
|
||||
let BaseT = getTypeInst(T)[1]
|
||||
result = bindSym($BaseT & "x" & $N)
|
||||
|
||||
type
|
||||
VecIntrin*[N: static int, T: SomeNumber] = dispatch(N, T)
|
||||
|
||||
func `$`*[N, T](vec: VecIntrin[N, T]): string =
|
||||
## Display a vector
|
||||
$cast[array[N, T]](vec)
|
||||
4
tests/generics/t14509.nim
Normal file
4
tests/generics/t14509.nim
Normal file
@@ -0,0 +1,4 @@
|
||||
import m14509
|
||||
|
||||
var v: VecIntrin[4, float32]
|
||||
doAssert $v == "[0.0, 0.0, 0.0, 0.0]"
|
||||
Reference in New Issue
Block a user