-
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.
Fix problems with selections and related features
- Loading branch information
Showing
12 changed files
with
108 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
module Predef with ... | ||
|
||
fun checkArgs(functionName, expected, got) = | ||
if got != expected then | ||
let name = if functionName.Str#length > 0 then " '".Str#concat(functionName).Str#concat("'") else "" | ||
throw new Error("Function".Str#concat(name).Str#concat(" expected ").Str#concat(expected).Str#concat(" arguments but got ").Str#concat(got)) | ||
else () | ||
fun checkArgs(functionName, expected, isUB, got) = | ||
if got < expected || isUB && got > expected do | ||
let name = if functionName.length > 0 then " '" + functionName + "'" else "" | ||
throw globalThis.Error("Function" + name + " expected " + expected + " arguments but got " + got) | ||
|
22 changes: 22 additions & 0 deletions
22
hkmc2/shared/src/test/mlscript/basics/ExplicitSelections.mls
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,22 @@ | ||
:js | ||
|
||
|
||
class Foo() with | ||
val x = 1 | ||
fun f() = x + 1 | ||
|
||
|
||
Foo().x | ||
//│ = 1 | ||
|
||
Foo().Foo#x | ||
//│ = 1 | ||
|
||
|
||
Foo().f() | ||
//│ = 2 | ||
|
||
Foo().Foo#f() | ||
//│ = 2 | ||
|
||
|
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