Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3d5ae1d
Removing even more @Builtin_Types from Enso types
JaroslavTulach Jan 19, 2026
b6b4bba
Directly construct Project_Description
JaroslavTulach Jan 19, 2026
215860f
Slightly less changes for now
JaroslavTulach Jan 19, 2026
3752515
Implementing RuntimeContext and Ordering behind a boundary
JaroslavTulach Jan 19, 2026
a32cb03
System_Process_Result doesn't have to be builtin type
JaroslavTulach Jan 19, 2026
3bb1f1c
Access to comparator field is now properly encapsulated
JaroslavTulach Jan 19, 2026
382e403
Removing @Builtin_Type from micro-distribution as well
JaroslavTulach Jan 19, 2026
400458d
Searching constructors behind @TruffleBoundary
JaroslavTulach Jan 19, 2026
7ec7e3e
Specify languageHomeOverride for all runtime-integration-tests to mak…
JaroslavTulach Jan 19, 2026
0555668
Ignore Standard.Base loading messages
JaroslavTulach Jan 19, 2026
3823091
Provide location of the missing path
JaroslavTulach Jan 19, 2026
373ad2a
Adjusting to Standard.Base being imported
JaroslavTulach Jan 19, 2026
907d03d
Restict the TCK check to Text and Number only
JaroslavTulach Jan 19, 2026
b87ee20
Giving Duration.+ and Duration.- proper types
JaroslavTulach Jan 19, 2026
67479c4
Checking that:Duration yields Type_Error now
JaroslavTulach Jan 19, 2026
067a219
Merge remote-tracking branch 'origin/develop' into wip/jtulach/EvenLe…
JaroslavTulach Jan 20, 2026
c2126ec
Introducing Type.getSingleConstructor()
JaroslavTulach Jan 20, 2026
dffcf48
Need @TruffleBoundary to work with HashMap
JaroslavTulach Jan 22, 2026
df3be7e
Cache Ordering related types
JaroslavTulach Jan 23, 2026
c02f82a
Need to use caching supplier
JaroslavTulach Jan 23, 2026
599865f
Merging with develop
JaroslavTulach Jan 23, 2026
d303b9b
Make singleConstructor @CompilationFinal
JaroslavTulach Jan 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2839,6 +2839,10 @@ lazy val `runtime-integration-tests` =
"-Dtck.language=enso",
"-Dtck.inlineVerifierInstrument=false",
"-Dpolyglot.engine.AllowExperimentalOptions=true",
"-Dpolyglot.enso.languageHomeOverride=" + new File(
engineDistributionRoot.value,
"component"
).getCanonicalPath,
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:HeapDumpPath=" + (Compile / packageBin).value.getParentFile
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Enso Signatures 1.0
## module Standard.Base.Data.Time.Duration
- type Duration
- + self that:Standard.Base.Any.Any -> Standard.Base.Any.Any
- - self that:Standard.Base.Any.Any -> Standard.Base.Any.Any
- + self that:Standard.Base.Data.Time.Duration.Duration -> Standard.Base.Data.Time.Duration.Duration!Standard.Base.Errors.Time_Error.Time_Error
- - self that:Standard.Base.Data.Time.Duration.Duration -> Standard.Base.Data.Time.Duration.Duration!Standard.Base.Errors.Time_Error.Time_Error
- < self that:Standard.Base.Any.Any -> Standard.Base.Any.Any
- <= self that:Standard.Base.Any.Any -> Standard.Base.Any.Any
- > self that:Standard.Base.Any.Any -> Standard.Base.Any.Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ from project.Internal.Ordering_Helpers import all
By defining the `Rational_Ordering` and making it available via
`Comparable.from (that:Rational)` method, all parts of the Enso system will use
the custom comparator whenever equality or hash code is needed.
@Builtin_Type
type Comparable
## ---
private: true
Expand Down Expand Up @@ -256,7 +255,6 @@ type Comparable
Comparable.from (that:Any) = Comparable.new that Default_Comparator

## Types representing the ordering of values.
@Builtin_Type
type Ordering
## A representation that the first value orders as less than the second.
Less
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ type Duration

example_add = (Duration.new minutes=30) + (Duration.new hours=12)
```
+ : Duration -> Duration ! Time_Error
+ self that =
+ self that:Duration -> Duration ! Time_Error =
ensure_duration that <|
Panic.catch ArithmeticException (self.plus_builtin that) err->
Error.throw (Time_Error.Error err.payload.getMessage)
Expand All @@ -203,8 +202,7 @@ type Duration

example_subtract = (Duration.new hours=6) - (Duration.new minutes=30)
```
- : Duration -> Duration ! Time_Error
- self that =
- self that:Duration -> Duration ! Time_Error =
ensure_duration that <|
Panic.catch ArithmeticException (self.minus_builtin that) err->
Error.throw (Time_Error.Error err.payload.getMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ from project.Error import all
private: true
---
Default implementation of a _comparator_.
@Builtin_Type
type Default_Comparator
## ---
private: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ from project.Data.Json import JS_Object
from project.Errors.Common import Module_Not_In_Package_Error

## Functionality for inspecting the current project.
@Builtin_Type
type Project_Description
## ---
private: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import project.Runtime.Source_Location.Source_Location
private: true
---
Utilities for working with Polyglot objects.
@Builtin_Type
type Polyglot
## ---
private: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ type Stack_Trace_Element
advanced: true
---
Type indicating allowed execution context.
@Builtin_Type
type Context
## ---
private: true
Expand Down
1 change: 0 additions & 1 deletion distribution/lib/Standard/Base/0.0.0-dev/src/System.enso
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ default_line_separator = Java_System.lineSeparator
private: true
---
The type representing the result of a process.
@Builtin_Type
type System_Process_Result
## ---
private: true
Expand Down
4 changes: 2 additions & 2 deletions docs/types/dynamic-dispatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ primarily as a _container for module (static) methods_.
- **associated type** of a module `My_Module` is a type for the module
- It is basically an eigen type for a module.
- **builtin type** is a type annotated with `@Builtin_Type`.
- Builtin type cannot be defined outside standard libraries.
- Builtin type cannot be defined outside `Standard.Base` library.
- Builtin types are usually implemented in the engine, and not with pure Enso
code.
Atom mechanism.
- **parent type** of a type `My_Type` is a type that `My_Type` "extends", i.e.
`My_Type` inherits all the methods defined on its parent type.
- Every type has exactly one parent type, except for `Any` type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public void ensureNonBuiltinMembersArePresent() throws Exception {
Source.newBuilder(
"enso",
"""
from Standard.Base import all

type Compile_Error
Error message

Expand All @@ -101,7 +103,14 @@ public void ensureNonBuiltinMembersArePresent() throws Exception {
var compileError = module.invokeMember("eval_expression", "v");
assertEquals(
"all members",
Set.of(ConstantsNames.TO_DISPLAY_TEXT, "message", ConstantsNames.TO_TEXT, "==", "pretty"),
Set.of(
ConstantsNames.TO_DISPLAY_TEXT,
"message",
ConstantsNames.TO_TEXT,
"to",
"==",
"!=",
"pretty"),
compileError.getMemberKeys());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,9 @@ class RuntimeVisualizationsTest extends AnyFlatSpec with Matchers {
)
)
)
context.receiveN(2) should contain theSameElementsAs Seq(
context.receiveNIgnoreExpressionUpdates(
2
) should contain theSameElementsAs Seq(
Api.Response(requestId, Api.VisualizationAttached()),
Api.Response(
Api.ExecutionFailed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ public Collection<? extends Snippet> createExpressions(Context context) {
.eval(
"enso",
"""
plus a b = a + b
from Standard.Base import all

plus a:Text|Number b:Text|Number = a + b
""")
.invokeMember("eval_expression", "plus");

return List.of(
/* disabled until + is defined on Numbers again
Snippet.newBuilder("plus:Number", plus, TypeDescriptor.NUMBER)
.parameterTypes(TypeDescriptor.NUMBER, TypeDescriptor.NUMBER)
.build(),
*/
.parameterTypes(TypeDescriptor.NUMBER, TypeDescriptor.NUMBER)
.build(),
Snippet.newBuilder("plus:Text", plus, TypeDescriptor.STRING)
.parameterTypes(TypeDescriptor.STRING, TypeDescriptor.STRING)
.build());
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,14 @@ private static Package<TruffleFile> getMainProjectFromCtx(EnsoContext ctx) {
return null;
}

@TruffleBoundary
private static Atom createProjectDescriptionAtom(EnsoContext ctx, Package<TruffleFile> pkg) {
var rootPath = pkg.root().normalize().getAbsoluteFile().getPath();
var namespace = pkg.getConfig().namespace();
var name = pkg.getConfig().name();
var cons = ctx.getBuiltins().getProjectDescription().getUniqueConstructor();

var ensoProject = ctx.getTopScope().getModule("Standard.Base.Meta.Enso_Project").get();
var projectDescription = ensoProject.getScope().getType("Project_Description", true);
var cons = projectDescription.getSingleConstructor();
return AtomNewInstanceNode.getUncached().newInstance(cons, rootPath, namespace, name);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ private static Object convertor(EnsoContext ctx, Function convFn, Object value)
argSchema, DefaultsExecutionMode.EXECUTE, ArgumentsExecutionMode.EXECUTE);
var state = ctx.currentState();
var by =
node.execute(convFn, null, state, new Object[] {ctx.getBuiltins().comparable(), value});
node.execute(
convFn, null, state, new Object[] {ctx.getBuiltins().comparableType(), value});
if (by instanceof Atom atom
&& atom.getConstructor() == ctx.getBuiltins().comparable().getBy()) {
&& atom.getConstructor() == ctx.getBuiltins().comparableType().getSingleConstructor()) {
var structs = StructsLibrary.getUncached();
return structs.getField(atom, 1);
} else {
Expand Down Expand Up @@ -158,7 +159,7 @@ Boolean findConversions(Type selfType, Type thatType, Object self, Object that)
private static boolean findConversionImpl(
EnsoContext ctx, Type selfType, Type thatType, Object self, Object that) {
var selfScope = selfType.getDefinitionScope();
var comparableType = ctx.getBuiltins().comparable().getType();
var comparableType = ctx.getBuiltins().comparableType();

var fromSelfType =
UnresolvedConversion.build(selfScope).resolveFor(ctx, comparableType, selfType);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ Type hasCustomComparatorCached(
InvokeConversionNode convertNode,
@Cached(value = "createConversion()", allowUncached = true) UnresolvedConversion conversion) {
var ctx = EnsoContext.get(this);
var comparableType = ctx.getBuiltins().comparable().getType();
var comparableType = ctx.getBuiltins().comparableType();
var state = ctx.currentState();
Object rawRes =
convertNode.execute(
null, state, conversion, comparableType, atom, new Object[] {comparableType, atom});
if (rawRes instanceof Atom res
&& res.getConstructor() == ctx.getBuiltins().comparable().getBy()) {
&& res.getConstructor() == ctx.getBuiltins().comparableType().getSingleConstructor()) {
if (structs.getField(res, 1) instanceof Type result) {
if (result != ctx.getBuiltins().defaultComparator().getType()) {
if (result != ctx.getBuiltins().defaultComparatorType()) {
return result;
}
}
Expand All @@ -65,7 +65,7 @@ Type hasCustomComparatorCached(
@NeverDefault
UnresolvedConversion createConversion() {
var ctx = EnsoContext.get(this);
var comparableType = ctx.getBuiltins().comparable().getType();
var comparableType = ctx.getBuiltins().comparableType();
return UnresolvedConversion.build(comparableType.getDefinitionScope());
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ long hashCallbackCached(
InvokeFunctionNode hashCallbackInvokeNode,
@CachedLibrary(limit = "5") InteropLibrary interop) {
var ctx = EnsoContext.get(this);
var comparableType = ctx.getBuiltins().comparable().getType();
var defCompType = ctx.getBuiltins().defaultComparator().getType();
var comparableType = ctx.getBuiltins().comparableType();
var defCompType = ctx.getBuiltins().defaultComparatorType();
Object res =
hashCallbackInvokeNode.execute(
hashCallbackFunc,
Expand Down Expand Up @@ -80,7 +80,7 @@ static InvokeFunctionNode buildInvokeNodeWithAtomArgument() {
@NeverDefault
@TruffleBoundary
Function getHashCallbackFunction() {
var defCompType = EnsoContext.get(this).getBuiltins().defaultComparator().getType();
var defCompType = EnsoContext.get(this).getBuiltins().defaultComparatorType();
var fn = defCompType.getDefinitionScope().getMethodForType(defCompType, "hash_callback");
assert fn != null : "Default_Comparator.hash_callback function must exist";
return fn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,7 @@ private Object attachDifferentComparatorsWarning(Object vector, List<Group> grou
private String getDefaultComparatorQualifiedName() {
return EnsoContext.get(this)
.getBuiltins()
.defaultComparator()
.getType()
.defaultComparatorType()
.getQualifiedName()
.toString();
}
Expand Down Expand Up @@ -493,7 +492,7 @@ boolean areAllDefaultComparators(
}

boolean isDefaultComparator(Object object, EnsoContext ctx) {
return ctx.getBuiltins().defaultComparator().getType() == object;
return ctx.getBuiltins().defaultComparatorType() == object;
}

private boolean isNan(Object object) {
Expand Down

This file was deleted.

Loading
Loading