-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Carry partially evaluated arguments in frameslot
In order to be able to refer to the previously defined parameters, the frame will now carry such state in the additional `FrameSlot`. In order to avoid paying the penalty of resolving dynamic symbols for all closures, decided to bring back `InstantiateAtomNode`. See test cases for the previously crashing examples.
- Loading branch information
Showing
7 changed files
with
150 additions
and
23 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
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,42 @@ | ||
from Standard.Base import all | ||
import Standard.Test | ||
|
||
type Box | ||
type Foo (v : Bool = True) | ||
|
||
type Bar (a : Integer = 1) (b : Box = (Foo False)) | ||
|
||
type A a=0 b=1 | ||
type B a=2 b=(Foo True) | ||
type C a=3 b=Foo | ||
type D a=4 b=(Bar 1) | ||
type E a=5 b=a c=(b+1) | ||
type F a=6 b=(Foo False) c=(b.v) | ||
#type D a=4 b=Bar // will crash | ||
|
||
spec = | ||
Test.group "Atom Constructors" <| | ||
Test.specify "should be allowed to use primitive default arguments" <| | ||
x = A 1 | ||
x.b.should_equal 1 | ||
y = A 1 | ||
y.b.should_equal 1 | ||
|
||
Test.specify "should be allowed to use non-primitive default arguments" <| | ||
a = B 1 (Foo False) | ||
a.b.should_equal (Foo False) | ||
b = B 1 | ||
b.b.should_equal (Foo True) | ||
c = C 1 | ||
c.b.should_equal (Foo) | ||
d = D 1 | ||
d.b.b.should_equal (Foo False) | ||
|
||
Test.specify "should be allowed to use default arguments that refer to previous parameters" <| | ||
e = E 1 | ||
e.b.should_equal 1 | ||
e.c.should_equal 2 | ||
f = F 1 | ||
f.c.should_equal False | ||
|
||
main = Test.Suite.run_main here.spec |