Skip to content

[TODO] type outType = type(10) prints as int literal(10) instead of int #8704

@timotheecour

Description

@timotheecour
# [`type outType = type(10)` prints as `int literal(10)` instead of `int` · Issue #8704 · nim-lang/Nim](https://github.com/nim-lang/Nim/issues/8704)
import typetraits

when defined(case1):
  type outType = type(10)
when defined(case2):
  let x=10
  type outType = type(x)

doAssert int is outType
doAssert outType is int

echo outType.name # BUG: int literal(10)
echo outType # BUG: int literal(10)

echo int.name # ok: int

# BUG: int literal(10) => this one could be due to `https://github.com/nim-lang/Nim/issues/8569` (compiler reuses whatever cached type name was previously found)
echo int

the 1st bug (echo outType.name shown as int literal(10)) looks new
it happens with case1; doesn't happen with case2 (ie only happens with litterals)

the subsequent ones could be due to #8569

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions