[fine] Many test improvements, error improvements

- Check for more error conditions
- Move to more definitive error assertions
- Simpler error messages in some cases
- Test more conditions more thoroughly, revisit old tests
This commit is contained in:
John Doty 2024-01-21 08:14:42 -08:00
parent d0b74db715
commit 5f0a0b3268
20 changed files with 186 additions and 118 deletions

View file

@ -1,10 +1,15 @@
let x = 23;
let y = x * 2;
let z = print(y);
let z = y;
z;
fun test() -> f64 {
x + y
}
// @no-errors
// @type: 41 f64
// @type: 38 f64
// @eval: Float(69.0)
// @concrete:
// | File
// | LetStatement
@ -29,25 +34,38 @@ z;
// | Let:'"let"'
// | Identifier:'"z"'
// | Equal:'"="'
// | CallExpression
// | Identifier
// | Identifier:'"print"'
// | ArgumentList
// | LeftParen:'"("'
// | Argument
// | Identifier
// | Identifier:'"y"'
// | RightParen:'")"'
// | Identifier
// | Identifier:'"y"'
// | Semicolon:'";"'
// | ExpressionStatement
// | Identifier
// | Identifier:'"z"'
// | Semicolon:'";"'
// | FunctionDecl
// | Fun:'"fun"'
// | Identifier:'"test"'
// | ParamList
// | LeftParen:'"("'
// | RightParen:'")"'
// | ReturnType
// | Arrow:'"->"'
// | TypeExpression
// | Identifier:'"f64"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | BinaryExpression
// | Identifier
// | Identifier:'"x"'
// | Plus:'"+"'
// | Identifier
// | Identifier:'"y"'
// | RightBrace:'"}"'
// |
// @compiles-to:
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (14):
// | code (12):
// | 0: PushFloat(23.0)
// | 1: StoreModule(0)
// | 2: LoadModule(0)
@ -55,11 +73,16 @@ z;
// | 4: FloatMultiply
// | 5: StoreModule(1)
// | 6: LoadModule(1)
// | 7: LoadExternFunction(0)
// | 8: Call(1)
// | 9: StoreModule(2)
// | 10: LoadModule(2)
// | 11: Discard
// | 12: PushNothing
// | 13: Return
// | 7: StoreModule(2)
// | 8: LoadModule(2)
// | 9: Discard
// | 10: PushNothing
// | 11: Return
// | function test (0 args, 0 locals):
// | strings (0):
// | code (4):
// | 0: LoadModule(0)
// | 1: LoadModule(1)
// | 2: FloatAdd
// | 3: Return
// |