You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following program causes an internal error in the compiler:
typeMyObject[T] =object
x: T
procinitMyObject[T](value = T.default): MyObject[T] =MyObject[T](x: value)
var obj =initMyObject[int]()
Current Output
Error: internal error: expr(skType); unknown symbol
Expected Output
Compilation successful.
Possible Solution
Explicitly specifying the type of the parameter solves the problem:
typeMyObject[T] =object
x: T
procinitMyObject[T](value: T = T.default): MyObject[T] =MyObject[T](x: value)
var obj =initMyObject[int]()
Additional Information
$ nim -v
Nim Compiler Version 1.4.2 [Linux: amd64]
Compiled at 2020-11-30
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: 3fb5157ab1b666a5a5c34efde0f357a82d433d04
active boot switches: -d:release
Also present in development version.
The text was updated successfully, but these errors were encountered:
The following program causes an internal error in the compiler:
Current Output
Expected Output
Compilation successful.
Possible Solution
Explicitly specifying the type of the parameter solves the problem:
Additional Information
Also present in development version.
The text was updated successfully, but these errors were encountered: