-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add imperfect support for operator blocks & fix misc. issues
- Loading branch information
Showing
16 changed files
with
305 additions
and
45 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 |
---|---|---|
|
@@ -64,5 +64,6 @@ module TraceLogger with | |
else () | ||
|
||
class Test with | ||
print("Test") | ||
val y = 1 | ||
|
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,46 @@ | ||
:todo | ||
|
||
|
||
fun foo(x){f} = | ||
f(x) | ||
//│ ╔══[ERROR] Expected a valid definition head, found block instead | ||
//│ ║ l.4: fun foo(x){f} = | ||
//│ ╙── ^ | ||
|
||
foo(1){x => x} | ||
//│ ╔══[ERROR] Name not found: foo | ||
//│ ║ l.10: foo(1){x => x} | ||
//│ ╙── ^^^ | ||
//│ ╔══[ERROR] Illegal juxtaposition right-hand side. | ||
//│ ║ l.10: foo(1){x => x} | ||
//│ ╙── ^^^^^^ | ||
|
||
foo(1) | ||
x => x | ||
//│ ╔══[ERROR] Name not found: foo | ||
//│ ║ l.18: foo(1) | ||
//│ ╙── ^^^ | ||
//│ ╔══[ERROR] Illegal juxtaposition right-hand side. | ||
//│ ║ l.19: x => x | ||
//│ ╙── ^^^^^^ | ||
|
||
foo(1) { x => x } | ||
//│ ╔══[ERROR] Name not found: foo | ||
//│ ║ l.27: foo(1) { x => x } | ||
//│ ╙── ^^^ | ||
//│ ╔══[ERROR] Illegal juxtaposition right-hand side. | ||
//│ ║ l.27: foo(1) { x => x } | ||
//│ ╙── ^^^^^^ | ||
|
||
foo(1) with x => x | ||
//│ ╔══[PARSE ERROR] Expected end of input; found 'with' keyword instead | ||
//│ ║ l.35: foo(1) with x => x | ||
//│ ╙── ^^^^ | ||
//│ ╔══[ERROR] Name not found: foo | ||
//│ ║ l.35: foo(1) with x => x | ||
//│ ╙── ^^^ | ||
|
||
|
||
|
||
|
||
|
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,85 @@ | ||
:js | ||
|
||
|
||
let xs = [0, 1, 2] | ||
//│ xs = [ 0, 1, 2 ] | ||
|
||
xs. print() | ||
//│ > 0,1,2 | ||
|
||
let f = xs. print | ||
//│ f = [Function (anonymous)] | ||
|
||
f() | ||
//│ > 0,1,2 | ||
|
||
xs.reverse() | ||
//│ = [ 2, 1, 0 ] | ||
|
||
xs | ||
//│ = [ 2, 1, 0 ] | ||
|
||
:re | ||
xs.map(x => x * 2) | ||
//│ ═══[RUNTIME ERROR] Error: Function expected 1 arguments but got 3 | ||
|
||
xs.map((x, i, a) => x * 2) | ||
//│ = [ 4, 2, 0 ] | ||
|
||
:fixme | ||
xs.map((x, ...) => x * 2) | ||
//│ /!!!\ Uncaught error: scala.MatchError: Spread(keyword '...',Some(Loc(11,14,MiscArrayTests.mls:+30)),None) (of class hkmc2.syntax.Tree$Spread) | ||
|
||
xs.map((x, ..._) => x * 2) | ||
//│ = [ 4, 2, 0 ] | ||
|
||
fun map(xs, f) = xs.map((x, ...bs) => f(x)) | ||
|
||
xs. map(x => x * 2). print() | ||
//│ > 4,2,0 | ||
|
||
:fixme | ||
:p | ||
xs. | ||
map(x => x * 2) | ||
//│ |xs|.|→|map|(|x| |=>| |x| |*| |2|)|←| | ||
//│ Parsed: | ||
//│ App(Ident(.),Tup(List(Ident(xs), Block(List(App(Ident(map),Tup(List(InfixApp(Tup(List(Ident(x))),keyword '=>',App(Ident(*),Tup(List(Ident(x), IntLit(2))))))))))))) | ||
//│ ═══[RUNTIME ERROR] Error: Function 'map' expected 2 arguments but got 1 | ||
|
||
:fixme | ||
:pt | ||
xs | ||
. map(f) | ||
//│ Parsed tree: | ||
//│ App: | ||
//│ lhs = Ident of "xs" | ||
//│ rhs = OpBlock of Ls of | ||
//│ Tuple2: | ||
//│ _1 = Ident of "." | ||
//│ _2 = App: | ||
//│ lhs = Ident of "map" | ||
//│ rhs = Tup of Ls of | ||
//│ Ident of "f" | ||
//│ ═══[RUNTIME ERROR] Error: Function 'map' expected 2 arguments but got 1 | ||
|
||
:fixme | ||
xs | ||
. map(x => x * 2) | ||
//│ ═══[RUNTIME ERROR] Error: Function 'map' expected 2 arguments but got 1 | ||
|
||
:fixme | ||
xs | ||
. map(x => x * 2) | ||
. print() | ||
//│ ═══[RUNTIME ERROR] Error: Function 'map' expected 2 arguments but got 1 | ||
|
||
fun f = print(0) | ||
|
||
f | ||
//│ > 0 | ||
|
||
f | ||
//│ > 0 | ||
|
||
|
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 |
---|---|---|
@@ -1,17 +1,37 @@ | ||
:js | ||
|
||
|
||
Predef.Test | ||
//│ = [class Test] | ||
|
||
Test === Predef.Test | ||
//│ = true | ||
|
||
Predef.Test === globalThis.Predef.Test | ||
//│ = true | ||
|
||
1 is Predef.Test | ||
//│ = false | ||
|
||
:fixme | ||
new Predef.Test is Predef.Test | ||
//│ ═══[RUNTIME ERROR] TypeError: tmp2 is not a constructor | ||
|
||
(new Predef.Test) is Predef.Test | ||
//│ > Test | ||
//│ = true | ||
|
||
new Predef.Test | ||
//│ > Test | ||
//│ = Test { y: 1 } | ||
|
||
(new Predef.Test).y | ||
//│ > Test | ||
//│ = 1 | ||
|
||
:re | ||
(new Predef.Test).x | ||
//│ > Test | ||
//│ ═══[RUNTIME ERROR] Error: Access to required field 'x' yielded 'undefined' | ||
|
||
|
Oops, something went wrong.