Skip to content

Commit

Permalink
Ah yes. You have to remember to upcast a lot in this language.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpressey committed Feb 15, 2022
1 parent bf63701 commit 64362ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/Castile.md
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ is accomplished.
| make list(value:v, next:null as list|void)
| }
|
| len : list|void -> integer
| length : list|void -> integer
| fun length(l: list|void) {
| typecase l is void { return 0 }
| typecase l is list { return 1 + length(l.next) }
Expand All @@ -1297,15 +1297,15 @@ is accomplished.
| make list(value:v, next:null as list|void)
| }
|
| len : list|void -> integer
| length : list|void -> integer
| fun length(l: list|void) {
| typecase l is void { return 0 }
| typecase l is list { return 1 + length(l.next) }
| }
|
| fun main() {
| l = make list(value:"first", next:null);
| print(str(length(l)));
| l = make list(value:"first", next:null as list|void);
| print(str(length(l as list|void)));
| }
? make

Expand Down

0 comments on commit 64362ab

Please sign in to comment.