nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.55k stars 1.47k forks source link

Imported static[T] proc breaks nimscript #13960

Open GULPF opened 4 years ago

GULPF commented 4 years ago

A proc with static[T] can break a nimscript when imported.

Example

File module.nim

proc f1*(f: string) =
  discard

proc f1*(f: static[string]) =
  discard

proc f2*() =
  let x = "abc"
  f1(x)

File script.nims

import module

var foo: bool

Current Output

$ nim e script.nims
Error: cannot evaluate at compile time: foo

Additional Information

Tested with latest devel.

timotheecour commented 3 years ago

see also https://github.com/nim-lang/Nim/issues/18275