-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
introduce a micro stdlib for testing #3531
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,8 @@ | ||
engine-version: 0.0.0-dev | ||
repositories: | ||
- name: main | ||
url: https://libraries.release.enso.org/libraries | ||
libraries: | ||
- name: Standard.Base | ||
repository: main | ||
version: 0.0.0-dev |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/manifest.yaml
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,3 @@ | ||
archives: | ||
- main.tgz | ||
dependencies: [] |
10 changes: 10 additions & 0 deletions
10
test/micro-distribution/lib/Standard/Base/0.0.0-dev/package.yaml
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,10 @@ | ||
name: Base | ||
namespace: Standard | ||
version: 0.0.0-dev | ||
license: APLv2 | ||
authors: | ||
- name: Enso Team | ||
email: [email protected] | ||
maintainers: | ||
- name: Enso Team | ||
email: [email protected] |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Any.enso
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,3 @@ | ||
type Any | ||
@Builtin_Type | ||
type Any |
7 changes: 7 additions & 0 deletions
7
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Array.enso
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,7 @@ | ||
type Array | ||
@Builtin_Type | ||
type Array | ||
|
||
new_1 item_1 = @Builtin_Method "Array.new_1" | ||
new_2 item_1 item_2 = @Builtin_Method "Array.new_2" | ||
empty = @Builtin_Method "Array.empty" |
11 changes: 11 additions & 0 deletions
11
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Boolean.enso
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,11 @@ | ||
type Boolean | ||
@Builtin_Type | ||
type Boolean | ||
|
||
if_then_else ~on_true ~on_false = @Builtin_Method "Boolean.if_then_else" | ||
|
||
@Builtin_Type | ||
type True | ||
|
||
@Builtin_Type | ||
type False |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/List.enso
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,3 @@ | ||
type List | ||
type Nil | ||
type Cons x xs |
7 changes: 7 additions & 0 deletions
7
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Numbers.enso
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,7 @@ | ||
type Number | ||
@Builtin_Type | ||
type Number | ||
|
||
type Integer | ||
@Builtin_Type | ||
type Integer |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text.enso
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,3 @@ | ||
type Text | ||
@Builtin_Type | ||
type Text |
11 changes: 11 additions & 0 deletions
11
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date.enso
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,11 @@ | ||
polyglot java import java.time.LocalDate | ||
polyglot java import java.time.format.DateTimeFormatter | ||
|
||
new year (month = 1) (day = 1) = LocalDate.of year month day | ||
|
||
type Date | ||
type Date internal_local_date | ||
year = this . internal_local_date . getYear | ||
month = this . internal_local_date . getMonthValue | ||
day = this . internal_local_date . getDayOfMonth | ||
to_text = DateTimeFormatter.ISO_LOCAL_DATE.format this.internal_local_date |
27 changes: 27 additions & 0 deletions
27
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Error/Common.enso
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,27 @@ | ||
type Panic | ||
@Builtin_Type | ||
type Panic | ||
throw payload = @Builtin_Method "Panic.throw" | ||
catch_primitive ~action handler = @Builtin_Method "Panic.catch_primitive" | ||
|
||
@Builtin_Type | ||
type Syntax_Error message | ||
@Builtin_Type | ||
type Polyglot_Error cause | ||
@Builtin_Type | ||
type Arithmetic_Error message | ||
@Builtin_Type | ||
type Type_Error expected actual name | ||
@Builtin_Type | ||
type Compile_Error message | ||
@Builtin_Type | ||
type Inexhaustive_Pattern_Match_Error scrutinee | ||
@Builtin_Type | ||
type Arity_Error expected_min expected_max actual | ||
|
||
type Error | ||
@Builtin_Type | ||
type Error | ||
throw payload = @Builtin_Method "Error.throw" | ||
catch_primitive handler = @Builtin_Method "Error.catch_primitive" | ||
catch (handler = x->x) = this.catch_primitive handler |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/IO.enso
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,3 @@ | ||
print_err message = @Builtin_Method "IO.print_err" | ||
println message = @Builtin_Method "IO.println" | ||
readln = @Builtin_Method "IO.readln" |
20 changes: 20 additions & 0 deletions
20
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Main.enso
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,20 @@ | ||
import project.IO | ||
export project.IO | ||
|
||
import project.Data.List | ||
from project.Data.List export Nil, Cons, List | ||
|
||
import project.Polyglot | ||
from project.Polyglot export all | ||
|
||
export project.Polyglot.Java | ||
import project.Polyglot.Java | ||
|
||
import project.Data.Array | ||
from project.Data.Array export Array | ||
|
||
import project.Error.Common | ||
from project.Error.Common export all | ||
|
||
import project.Data.Numbers | ||
from project.Data.Numbers export Number |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Nothing.enso
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,3 @@ | ||
type Nothing | ||
@Builtin_Type | ||
type Nothing |
13 changes: 13 additions & 0 deletions
13
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Polyglot.enso
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,13 @@ | ||
type Polyglot | ||
@Builtin_Type | ||
type Polyglot | ||
get_array_size array = @Builtin_Method "Polyglot.get_array_size" | ||
execute callable arguments = @Builtin_Method "Polyglot.execute" | ||
get_member object member_name = @Builtin_Method "Polyglot.get_member" | ||
get_members object = @Builtin_Method "Polyglot.get_members" | ||
new constructor arguments = @Builtin_Method "Polyglot.new" | ||
invoke target name arguments = @Builtin_Method "Polyglot.invoke" | ||
has_source_location value = @Builtin_Method "Polyglot.has_source_location" | ||
get_source_location value = @Builtin_Method "Polyglot.get_source_location" | ||
is_language_installed language_name = @Builtin_Method "Polyglot.is_language_installed" | ||
get_executable_name = @Builtin_Method "Polyglot.get_executable_name" |
1 change: 1 addition & 0 deletions
1
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Polyglot/Java.enso
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 @@ | ||
lookup_class name = @Builtin_Method "Java.lookup_class" |
2 changes: 2 additions & 0 deletions
2
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Debug.enso
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,2 @@ | ||
eval expression = @Builtin_Method "Debug.eval" | ||
breakpoint = @Builtin_Method "Debug.breakpoint" |
10 changes: 10 additions & 0 deletions
10
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Resource.enso
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,10 @@ | ||
bracket : Any -> (Any -> Nothing) -> (Any -> Any) -> Any | ||
bracket ~constructor ~destructor ~action = @Builtin_Method "Resource.bracket" | ||
|
||
type Managed_Resource | ||
@Builtin_Type | ||
type Managed_Resource | ||
register resource function = @Builtin_Method "Managed_Resource.register" | ||
finalize = @Builtin_Method "Managed_Resource.finalize" | ||
with ~action = @Builtin_Method "Managed_Resource.with" | ||
take = @Builtin_Method "Managed_Resource.take" |
3 changes: 3 additions & 0 deletions
3
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/State.enso
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,3 @@ | ||
run key local_state ~computation = @Builtin_Method "State.run" | ||
get key = @Builtin_Method "State.get" | ||
put key new_state = @Builtin_Method "State.put" |
1 change: 1 addition & 0 deletions
1
test/micro-distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Thread.enso
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 @@ | ||
with_interrupt_handler ~action ~interrupt_handler = @Builtin_Method "Thread.with_interrupt_handler" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the idea. But I think we should call it
Micro.Base
, so that it is even more obvious that the test is working with the reduced stdlib. Otherwise, I'm afraid that the name might be a source of confusion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Gonna go with
Microstd
tho, so that it's 8 characters and I don't have to fix offset-based tests :PThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@4e6 turns out I cannot do it – the name
Standard
is assumed in a bunch of places in the codebase, and the interpreter breaks without it. Thoughts?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Let's live with another
Standard.Base
for nowThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tracking issue to un-hardcode the interpreter https://www.pivotaltracker.com/n/projects/2539304/stories/182487649