Skip to content

VM replaces declared type with alias #19198

@jcosborn

Description

@jcosborn

In the below code, the type of x is set to Foo even though it was declared int and Foo is not in scope.
This causes a compiler crash later when x is used since Foo is a generic and wasn't instantiated.

Example

block: type Foo[n: static int] = int block: static: let x = int 1 echo x.type # Foo  block: static: let x = int 1 let y = x + 1 # Error: unhandled exception: value out of range: -8 notin 0 .. 65535 [RangeDefect]  echo y

Current Output

Foo fatal.nim(53) sysFatal Error: unhandled exception: value out of range: -8 notin 0 .. 65535 [RangeDefect] 

Expected Output

int 2 

Possible Solution

Additional Information

This happens on devel, 1.6 and 1.4.

This is related to #15356.

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