Skip to content

Compiler "does not detect" a type recursion error in the wrong code, remaining frozen #13763

Closed
@rockcavera

Description

The sample code below made me waste about 30 minutes looking for the reason I wasn't compiling, because the compiler was frozen, maybe an infinite loop. I had to give ctrl + c to break the compiler execution.

I had added about 40 lines to a code of 700 and a few lines. I ended up forgetting to make the reference to the Obj type and wasted 30 minutes until I realized it.

Example

type
  TesteNewObj = object
    test: uint64
  
  TesteNew = ref TesteNew # Error here. The correct thing would be 'TesteNewObj'

Current Output

nim c teste
Hint: used config file 'D:\Nim\config\nim.cfg' [Conf]
Hint: used config file 'D:\Nim\config\config.nims' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: teste [Processing]
SIGINT: Interrupted by Ctrl-C.

Expected Output

nim c teste
Hint: used config file 'd:\nim-stable\config\nim.cfg' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: teste [Processing]
teste.nim(5, 3) Error: illegal recursion in type 'TesteNew'

Additional Information

  • It was working in version 1.0.6, maybe it's a regression
$ nim -v
Nim Compiler Version 1.1.1 [Windows: amd64]
Compiled at 2020-03-25
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: 98753da33188e3eef2362c4ed3c2bea166b8f10b
active boot switches: -d:release

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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