tokiwa-software / fuzion

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

match statement using syntax `?` and `|` does not allow line breaks unless parentheses are used #3776

Open simonvonhackewitz opened 2 weeks ago

simonvonhackewitz commented 2 weeks ago
> FUZION_DISABLE_ANSI_ESCAPES=true fz -e "`printf "x := true ? TRUE => say "true"\n          | FALSE => \n"`"

command line:2:11: error 1: Inconsistent indentation
          | FALSE => 
----------^
Indentation reference point is command line:1:1:
x := true ? TRUE => say true
^
While parsing: exprs, parse stack: exprs, block, unit

command line:1:11: error 2: 'match' expression does not cover all of the subject's types
x := true ? TRUE => say true
----------^
Missing cases for types: 'FALSE'
Subject type is one of 'FALSE' or 'TRUE'.

command line:2:13: error 3: Feature not visible at call site
          | FALSE => 
------------^^^^^
Feature not found: 'FALSE' (no arguments)
Target feature: 'universe'
In call: 'FALSE'
To solve this, you might change the visibility of the feature 'FALSE' (no arguments) at $MODULE/bool.fz:147:16:
private:public FALSE is
---------------^^^^^

3 errors.

With parentheses it works

> FUZION_DISABLE_ANSI_ESCAPES=true fz -e "`printf "x := (true ? TRUE => say "true"\n           | FALSE => )\n"`"
true
michaellilltokiwa commented 2 days ago
x := true ? TRUE => say true
          | FALSE =>