-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
942 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (C) 2024 Toitware ApS. | ||
// Use of this source code is governed by a Zero-Clause BSD license that can | ||
// be found in the tests/LICENSE file. | ||
main: | ||
test-default-true --x | ||
test-default-true --x=false | ||
test-default-true --x=true | ||
test-default-true --no-x | ||
test-default-true --x=null | ||
|
||
test-default-false --x | ||
test-default-false --x=false | ||
test-default-false --x=true | ||
test-default-false --no-x | ||
test-default-false --x=null | ||
|
||
test-non-default --x | ||
test-non-default --x=true | ||
test-non-default --no-x | ||
test-non-default --x=false | ||
|
||
test-non-default-non-literal --x | ||
test-non-default-non-literal --x=true | ||
test-non-default-non-literal --no-x | ||
test-non-default-non-literal --x=false | ||
|
||
test-default-true --x/bool=true: | ||
return x | ||
|
||
test-default-false --x/bool=false: | ||
return x | ||
|
||
test-non-default --x/bool=true: | ||
return x | ||
|
||
test-non-default-non-literal --x/bool=gettrue: | ||
return x | ||
|
||
gettrue: | ||
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
tests/type_propagation/gold/default-arguments-test.gold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
main tests/type_propagation/default-arguments-test.toit | ||
0[020] - load literal true | ||
2[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{True}] -> {True} | ||
5[041] - pop 1 | ||
6[020] - load literal false | ||
8[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{False}] -> {True|False} | ||
11[041] - pop 1 | ||
12[020] - load literal true | ||
14[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{True}] -> {True} | ||
17[041] - pop 1 | ||
18[020] - load literal false | ||
20[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{False}] -> {True|False} | ||
23[041] - pop 1 | ||
24[022] - load null | ||
25[053] - invoke static test-default-true tests/type_propagation/default-arguments-test.toit // [{Null_}] -> {True} | ||
28[041] - pop 1 | ||
29[020] - load literal true | ||
31[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{True}] -> {True|False} | ||
34[041] - pop 1 | ||
35[020] - load literal false | ||
37[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{False}] -> {False} | ||
40[041] - pop 1 | ||
41[020] - load literal true | ||
43[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{True}] -> {True|False} | ||
46[041] - pop 1 | ||
47[020] - load literal false | ||
49[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{False}] -> {False} | ||
52[041] - pop 1 | ||
53[022] - load null | ||
54[053] - invoke static test-default-false tests/type_propagation/default-arguments-test.toit // [{Null_}] -> {False} | ||
57[041] - pop 1 | ||
58[020] - load literal true | ||
60[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{True}] -> {True} | ||
63[041] - pop 1 | ||
64[020] - load literal true | ||
66[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{True}] -> {True} | ||
69[041] - pop 1 | ||
70[020] - load literal false | ||
72[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{False}] -> {True|False} | ||
75[041] - pop 1 | ||
76[020] - load literal false | ||
78[053] - invoke static test-non-default tests/type_propagation/default-arguments-test.toit // [{False}] -> {True|False} | ||
81[041] - pop 1 | ||
82[020] - load literal true | ||
84[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{True}] -> {True} | ||
87[041] - pop 1 | ||
88[020] - load literal true | ||
90[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{True}] -> {True} | ||
93[041] - pop 1 | ||
94[020] - load literal false | ||
96[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{False}] -> {True|False} | ||
99[041] - pop 1 | ||
100[020] - load literal false | ||
102[053] - invoke static test-non-default-non-literal tests/type_propagation/default-arguments-test.toit // [{False}] -> {True|False} | ||
105[090] - return null S1 0 | ||
|
||
test-default-true tests/type_propagation/default-arguments-test.toit | ||
- argument 0: {Null_|True|False} | ||
0[016] - load local 2 | ||
1[022] - load null | ||
2[094] - identical | ||
3[083] - branch if false T10 | ||
6[020] - load literal true | ||
8[004] - store local, pop S3 | ||
10[052] - load local, as class, pop 2 - True(21 - 23) // {True|False} | ||
12[016] - load local 2 | ||
13[089] - return S1 1 | ||
|
||
test-default-false tests/type_propagation/default-arguments-test.toit | ||
- argument 0: {Null_|True|False} | ||
0[016] - load local 2 | ||
1[022] - load null | ||
2[094] - identical | ||
3[083] - branch if false T10 | ||
6[020] - load literal false | ||
8[004] - store local, pop S3 | ||
10[052] - load local, as class, pop 2 - True(21 - 23) // {True|False} | ||
12[016] - load local 2 | ||
13[089] - return S1 1 | ||
|
||
test-non-default tests/type_propagation/default-arguments-test.toit | ||
- argument 0: {True|False} | ||
0[016] - load local 2 | ||
1[022] - load null | ||
2[094] - identical | ||
3[083] - branch if false T10 | ||
6[020] - load literal true | ||
8[004] - store local, pop S3 | ||
10[052] - load local, as class, pop 2 - True(21 - 23) // {True} | ||
12[016] - load local 2 | ||
13[089] - return S1 1 | ||
|
||
test-non-default-non-literal tests/type_propagation/default-arguments-test.toit | ||
- argument 0: {True|False} | ||
0[016] - load local 2 | ||
1[022] - load null | ||
2[094] - identical | ||
3[083] - branch if false T11 | ||
6[053] - invoke static gettrue tests/type_propagation/default-arguments-test.toit // {True} | ||
9[004] - store local, pop S3 | ||
11[052] - load local, as class, pop 2 - True(21 - 23) // {True} | ||
13[016] - load local 2 | ||
14[089] - return S1 1 | ||
|
||
gettrue tests/type_propagation/default-arguments-test.toit | ||
0[020] - load literal true | ||
2[089] - return S1 0 |
Oops, something went wrong.