tokiwa-software / fuzion

The Fuzion Language Implementation
https://fuzion-lang.dev
GNU General Public License v3.0
46 stars 11 forks source link

type inference fails to infer types of nullary lambda expression #1015

Open michaellilltokiwa opened 1 year ago

michaellilltokiwa commented 1 year ago
f := () -> say "hello"
f

/home/sam/playground/test.fz:2:1: error 1: Illegal forward or cyclic type inference
f
^
The definition of a field using ':=', or of a feature or function
using '=>' must not create cyclic type dependencies.
Referenced feature: 'f' at /home/sam/playground/test.fz:1:1:
f := () -> say "hello"
^

one error.
michaellilltokiwa commented 11 months ago

Another example:

test_ambig is

  if true
    x := 42

  if true
    x := 007
    f := ()->x