google / starlark-go

Starlark in Go: the Starlark configuration language, implemented in Go
BSD 3-Clause "New" or "Revised" License
2.32k stars 212 forks source link

internal error when referencing cell before initialization #340

Closed alandonovan closed 3 years ago

alandonovan commented 3 years ago
$ starlark
Welcome to Starlark (go.starlark.net)
>>> def f():
...   def g(): return x
...   if False:
...     x = 1
...   return g()
... 
>>> f()
Traceback (most recent call last):
  <stdin>:1:2: in <expr>
  <stdin>:5:11: in f
  <stdin>:2:19: in g
Error: internal error: nil (not None) returned from <function g>
alandonovan commented 3 years ago

Related:

$ starlark
Welcome to Starlark (go.starlark.net)
>>> def f():
...   def g(): return x
...   if False:
...    x = 1
...   return x
... 
>>> f()
Traceback (most recent call last):
  <stdin>:1:2: in <expr>
  <stdin>:5:10: in f
Error: internal error: nil (not None) returned from <function f>