Revert "leave type section symbols unchanged on resem, fix overly general double semcheck for forward types (#24888)"

This reverts commit cfe89097e7.
This commit is contained in:
narimiran
2025-04-21 23:07:52 +02:00
parent 1db543e8b2
commit f7145dd26e
6 changed files with 37 additions and 141 deletions

View File

@@ -1,55 +0,0 @@
discard """
output: '''
NONE
a
NONE
a
'''
"""
# issue #24887
macro foo(x: typed) =
result = x
foo:
type
Flags64 = distinct uint64
const NONE = Flags64(0'u64)
const MAX: Flags64 = Flags64(uint64.high)
proc `$`(x: Flags64): string =
case x:
of NONE:
return "NONE"
of MAX:
return "MAX"
else:
return "UNKNOWN"
let okay = Flags64(128'u64)
echo $NONE
type Foo = ref object
x: int
discard Foo(x: 123)
type Enum = enum a, b, c
echo a
type Bar[T] = object
x: T
discard Bar[int](x: 123)
discard Bar[string](x: "abc")
# regression test:
template templ(): untyped =
proc injected() {.inject.} = discard
int
type TestInject = templ()
var x1: TestInject
injected() # normally works
echo $NONE
echo a
var x2: TestInject
injected()