[fine] More test more!

This commit is contained in:
John Doty 2024-01-15 07:19:29 -08:00
parent 2f8e1bad85
commit 257a7e64c2
2 changed files with 51 additions and 32 deletions

View file

@ -1,51 +1,59 @@
if true { "discarded"; 23 } else { 45 }
fun test() {
if true { "discarded"; 23 } else { 45 }
}
// @no-errors
// Here come some type probes!
// (type of the condition)
// @type: 3 bool
// @type: 20 bool
//
// (the discarded expression)
// @type: 10 string
// @type: 27 string
//
// (the "then" clause)
// @type: 23 f64
// @type: 26 f64
// @type: 40 f64
// @type: 43 f64
//
// (the "else" clause)
// @type: 35 f64
// @type: 38 f64
//
// (the overall expression)
// @type: 0 f64
// @type: 52 f64
// @type: 55 f64
//
// @concrete:
// | File
// | IfStatement
// | ConditionalExpression
// | If:'"if"'
// | LiteralExpression
// | True:'"true"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | FunctionDecl
// | Fun:'"fun"'
// | Identifier:'"test"'
// | ParamList
// | LeftParen:'"("'
// | RightParen:'")"'
// | Block
// | LeftBrace:'"{"'
// | IfStatement
// | ConditionalExpression
// | If:'"if"'
// | LiteralExpression
// | String:'"\"discarded\""'
// | Semicolon:'";"'
// | ExpressionStatement
// | LiteralExpression
// | Number:'"23"'
// | RightBrace:'"}"'
// | Else:'"else"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | LiteralExpression
// | Number:'"45"'
// | RightBrace:'"}"'
// | True:'"true"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | LiteralExpression
// | String:'"\"discarded\""'
// | Semicolon:'";"'
// | ExpressionStatement
// | LiteralExpression
// | Number:'"23"'
// | RightBrace:'"}"'
// | Else:'"else"'
// | Block
// | LeftBrace:'"{"'
// | ExpressionStatement
// | LiteralExpression
// | Number:'"45"'
// | RightBrace:'"}"'
// | RightBrace:'"}"'
//
// @compiles-to:
// | function << module >> (0 args, 0 locals):
// | function test (0 args, 0 locals):
// | strings (1):
// | 0: "discarded"
// | code (8):
@ -57,4 +65,10 @@ if true { "discarded"; 23 } else { 45 }
// | 5: Jump(7)
// | 6: PushFloat(45.0)
// | 7: Return
// | function << module >> (0 args, 0 locals):
// | strings (0):
// | code (2):
// | 0: PushNothing
// | 1: Return
// |
// @eval: Float(23.0)