fuzion icon indicating copy to clipboard operation
fuzion copied to clipboard

Error message for mutate when falsely using `.new` insted of `.env.new` could be improved

Open simonvonhackewitz opened this issue 1 year ago • 0 comments

Using mi.new instead of mi.env.new in the example below causes the error *** panic: *** invalid mutate for Type of 'get_str#0.mi'. This error message could possibly be improved, as it might be hard to find the cause the way it is now.

wrong:

  get_str =>
    mi : mutate is
    mi.go ()->
      res := mi.new String ""

      for i in 0..9 do
        res <- res.get + $i
      res.get

  say get_str

correct:

  get_str =>
    mi : mutate is
    mi.go ()->
      res := mi.env.new String ""

      for i in 0..9 do
        res <- res.get + $i
      res.get

  say get_str

simonvonhackewitz avatar Jul 09 '24 14:07 simonvonhackewitz