Skip to content
Merged
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
09de69e
Registering constructors the normal way provides proper defaulted arg…
JaroslavTulach Jan 12, 2026
12abd90
Error types aren't builtin types - in a sence of needing special impl…
JaroslavTulach Jan 12, 2026
18de60a
Implementation of AtomFactory.getUniqueConstructor
JaroslavTulach Jan 13, 2026
ae1498c
test/Base_Tests execute (and fail)
JaroslavTulach Jan 13, 2026
7d9859b
Making runtime-integration-tests compile
JaroslavTulach Jan 13, 2026
414d1ad
Removing error @Builtin_Type from microdistribution
JaroslavTulach Jan 13, 2026
0fe2f63
Compile_Error is no longer @Builtin_Type
JaroslavTulach Jan 13, 2026
723e0bf
Don't hold on context via PolyglotException
JaroslavTulach Jan 13, 2026
c4edd92
Load Standard.Base and compile module if needed
JaroslavTulach Jan 14, 2026
5fb18ab
DesignExecutionEnvironmentTest needs type Unimplemented
JaroslavTulach Jan 14, 2026
23af588
Central place to control the timeout
JaroslavTulach Jan 14, 2026
b54330a
Indefinitely waiting for guest-code threads may cause a deadlock
JaroslavTulach Jan 14, 2026
235ee0d
Easier to define to_display_text on the type itself
JaroslavTulach Jan 14, 2026
a8f956d
Constructor Private_Access.Error is private and its instantiation is …
JaroslavTulach Jan 14, 2026
f54136e
Hiding Panic's constructor
JaroslavTulach Jan 14, 2026
9842b26
Adjusting tests to human readable error messages
JaroslavTulach Jan 14, 2026
429b051
Human readable error messages
JaroslavTulach Jan 14, 2026
d488a4f
Merge remote-tracking branch 'origin/develop' into wip/jtulach/Overus…
JaroslavTulach Jan 15, 2026
0676066
Merge branch 'wip/jtulach/OveruseOfBuiltinTypes13664' of enso:enso-or…
JaroslavTulach Jan 15, 2026
3627ceb
Removing unknown types
JaroslavTulach Jan 15, 2026
80db4fd
Human readable error message in if_then_else
JaroslavTulach Jan 15, 2026
1d44444
Human readable messages and receiveNIgnoreStdLib
JaroslavTulach Jan 15, 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
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
- to_display_text self -> Standard.Base.Any.Any
- type Invalid_Conversion_Target
- Error target:Standard.Base.Any.Any
- to_display_text self -> Standard.Base.Data.Text.Text
- type Length_Mismatch
- to_display_text self -> Standard.Base.Any.Any
- to_js_object self -> Standard.Base.Any.Any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Enso Signatures 1.0
## module Standard.Base.Panic
- type Caught_Panic
- Panic payload:Standard.Base.Any.Any internal_original_exception:Standard.Base.Any.Any
- convert_to_dataflow_error self -> Standard.Base.Any.Any
- payload self -> Standard.Base.Any.Any
- stack_trace self -> Standard.Base.Any.Any
- type Panic
- catch panic_type:Standard.Base.Any.Any ~action:Standard.Base.Any.Any handler:Standard.Base.Any.Any -> Standard.Base.Any.Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,6 @@ type Builder
the sub-`Vector` within the outermost `Vector`, and so on.
An error that is wrapped as a `Map_Error` can be caught as a `Map_Error`, or
as itself. In the latter case, the `Map_Error` wrapper is stripped off.
@Builtin_Type
type Map_Error
## ---
private: true
Expand All @@ -1816,7 +1815,6 @@ type Map_Error
private: true
---
Indicates that a method should not wrap thrown errors in `Map_Error`.
@Builtin_Type
type No_Wrap
## ---
private: true
Expand Down
41 changes: 12 additions & 29 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Errors/Common.enso
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type Not_Found
to_display_text self =
"The target was not found."

@Builtin_Type
type Index_Out_Of_Bounds
## ---
private: true
Expand All @@ -52,7 +51,6 @@ type Index_Out_Of_Bounds
to_display_text self =
"The index " + self.index.to_text + " is out of bounds in a collection of length " + self.length.to_text + "."

@Builtin_Type
type Syntax_Error
## ---
private: true
Expand All @@ -70,7 +68,6 @@ type Syntax_Error
to_display_text : Text
to_display_text self = "Syntax error: "+self.message+"."

@Builtin_Type
type Type_Error
## ---
private: true
Expand Down Expand Up @@ -135,7 +132,6 @@ type Type_Error
to_js_object self =
JS_Object.from_pairs [["type", "Type_Error"], ["expected", self.expected], ["actual", self.actual], ["comment", self.comment]]

@Builtin_Type
type Compile_Error
## ---
private: true
Expand All @@ -153,7 +149,6 @@ type Compile_Error
to_display_text : Text
to_display_text self = "Compile error: "+self.message+"."

@Builtin_Type
type Assertion_Error
## ---
private: true
Expand All @@ -167,7 +162,6 @@ type Assertion_Error
to_display_text : Text
to_display_text self = "Assertion Error: '" + self.message.to_text + "'"

@Builtin_Type
type Inexhaustive_Pattern_Match
## ---
private: true
Expand All @@ -185,7 +179,6 @@ type Inexhaustive_Pattern_Match
to_display_text : Text
to_display_text self = "Inexhaustive pattern match: no branch matches "+self.scrutinee.to_display_text+"."

@Builtin_Type
type Arity_Error
## ---
private: true
Expand All @@ -211,7 +204,6 @@ type Arity_Error

"Wrong number of arguments. Expected "+expectedRange+", but got "+self.actual.to_text+"."

@Builtin_Type
type Uninitialized_State
## ---
private: true
Expand All @@ -230,7 +222,6 @@ type Uninitialized_State
to_display_text : Text
to_display_text self = "State is not initialized for type "+self.key.to_display_text+"."

@Builtin_Type
type No_Such_Method
## ---
private: true
Expand Down Expand Up @@ -277,7 +268,6 @@ type No_Such_Method
"type " + (Meta.type_of self.target).to_display_text
"Method `"+self.method_name+"` of "+target_name+" could not be found."

@Builtin_Type
type No_Such_Field
## ---
private: true
Expand All @@ -299,7 +289,6 @@ type No_Such_Field
value_type_name = if Meta.is_polyglot self.value then self.value.to_display_text else (Meta.type_of self.value).to_display_text
"Field `"+self.field_name+"` of "+value_type_name+" could not be found."

@Builtin_Type
type Module_Not_In_Package_Error
## An error that occurs when the enso_project function is called in a file
that is not part of a project.
Expand All @@ -312,7 +301,6 @@ type Module_Not_In_Package_Error
to_display_text : Text
to_display_text self = "Module is not a part of a package."

@Builtin_Type
type Arithmetic_Error
## ---
private: true
Expand All @@ -338,7 +326,6 @@ type Arithmetic_Error
handle_java_exception =
Panic.catch ArithmeticException handler=(cause-> Error.throw (Arithmetic_Error.Error cause.payload.getMessage))

@Builtin_Type
type Incomparable_Values
## An error that indicates that the two values are not comparable.

Expand Down Expand Up @@ -374,7 +361,6 @@ type Incomparable_Values
handle Type_Error <| handle Unsupported_Argument_Types <| handle ClassCastException <| handle_cmp_exc <|
function

@Builtin_Type
type Invalid_Array_Index
## ---
private: true
Expand All @@ -394,7 +380,6 @@ type Invalid_Array_Index
to_display_text : Text
to_display_text self = "Invalid array index: "+self.index.to_text+"."

@Builtin_Type
type Not_Invokable
## ---
private: true
Expand All @@ -418,7 +403,6 @@ type Not_Invokable
_ -> " Caused by: "+self.cause.to_display_text
"Type error: expected a function, but got "+self.target.to_display_text+"."+suffix

@Builtin_Type
type No_Such_Argument
## ---
private: true
Expand All @@ -437,7 +421,6 @@ type No_Such_Argument
to_display_text : Text
to_display_text self = "The named argument `"+self.argument_name.to_text+"` did not match any argument names. Perhaps it is misspelled?"

@Builtin_Type
type Private_Access
## ---
private: true
Expand Down Expand Up @@ -484,7 +467,6 @@ type Private_Access
+ this_proj
+ "."

@Builtin_Type
type Unsupported_Argument_Types
## ---
private: true
Expand All @@ -504,7 +486,6 @@ type Unsupported_Argument_Types
to_display_text : Text
to_display_text self = self.message.to_text

@Builtin_Type
type Module_Does_Not_Exist
## ---
private: true
Expand All @@ -522,7 +503,6 @@ type Module_Does_Not_Exist
to_display_text : Text
to_display_text self = "Module "+self.name+" does not exist."

@Builtin_Type
type Invalid_Conversion_Target
## ---
private: true
Expand All @@ -534,7 +514,13 @@ type Invalid_Conversion_Target
- `target`: the type trying to be converted to.
Error target

@Builtin_Type
## ---
private: true
---
Convert to a human-readable format.
to_display_text self -> Text =
self.target.to_display_text + " is not a valid conversion target. Expected a type."

type No_Such_Conversion
## ---
private: true
Expand All @@ -555,7 +541,6 @@ type No_Such_Conversion
to_display_text : Text
to_display_text self = "Could not find a conversion from `"+self.that.to_display_text+"` to `"+self.target.to_display_text+"`."

@Builtin_Type
type No_Conversion_Currying
## ---
private: true
Expand Down Expand Up @@ -585,7 +570,6 @@ type No_Conversion_Currying
True -> "Conversion currying without `this` argument is not supported."
False -> "Conversion currying without `this` and `that` arguments is not supported."

@Builtin_Type
type Forbidden_Operation
## ---
private: true
Expand Down Expand Up @@ -646,7 +630,6 @@ type Out_Of_Memory

## Indicates that an expression cannot be evaluated because somewhere within it,
a function does not have all required arguments provided.
@Builtin_Type
type Missing_Argument
## ---
private: true
Expand Down Expand Up @@ -674,13 +657,13 @@ type Missing_Argument
function_name = function_frame.name
call_location = caller_frame.source_location

# FIXME: Default arguments do not appear to be applied to constructors of builtin types
error = if message_override.is_nothing then Missing_Argument.Error argument_name function_name call_location ("Provide a value for the argument `" + argument_name + "`.") else
Missing_Argument.Error argument_name function_name call_location message_override
Error.throw error
Error.throw <|
if message_override.is_nothing then
Missing_Argument.Error argument_name function_name call_location
else
Missing_Argument.Error argument_name function_name call_location message_override

## Warning when additional warnings occurred.
@Builtin_Type
type Additional_Warnings
## ---
private: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import project.Data.Text.Text
import project.Nothing.Nothing
import project.Panic.Panic

@Builtin_Type
type Unimplemented
## ---
private: true
Expand Down
10 changes: 8 additions & 2 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Panic.enso
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ type Panic
## ---
private: true
---
@Builtin_Type
type Caught_Panic
## ---
private: true
Expand All @@ -308,7 +307,7 @@ type Caught_Panic
- `payload`: the payload carried by the error.
- `internal_original_exception (private)`: the original Java exception
that is the source of this panic. Only for internal use.
Panic payload internal_original_exception
private Panic internal_payload internal_original_exception

## ---
icon: panic
Expand All @@ -326,6 +325,13 @@ type Caught_Panic
stack_trace self =
Panic.get_attached_stack_trace self

## ---
private: true
---
Getter for the payload

payload self = self.internal_payload

## ---
private: true
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ public void conditionMustBeBoolean() {
var res = check.execute("Yes").asString();
fail("Expecting error, not: " + res);
} catch (PolyglotException ex) {
assertThat(ex.getMessage(), Matchers.containsString(".Error"));
assertThat(ex.getMessage(), Matchers.containsString("no branch matches Yes"));
}
try {
var res = check.execute((Object) null).asString();
fail("Expecting error, not: " + res);
} catch (PolyglotException ex) {
assertThat(ex.getMessage(), Matchers.containsString(".Error"));
assertThat(ex.getMessage(), Matchers.containsString("no branch matches Nothing"));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.enso.interpreter.runtime.callable.argument.ArgumentDefinition;
import org.enso.interpreter.runtime.callable.function.Function;
import org.enso.interpreter.runtime.callable.function.FunctionSchema;
import org.enso.interpreter.runtime.data.Type;
import org.enso.interpreter.runtime.data.text.Text;
import org.enso.interpreter.runtime.error.PanicException;
import org.enso.interpreter.runtime.error.PanicSentinel;
Expand Down Expand Up @@ -83,7 +84,7 @@ public void catchAnyPanic() {
var args = Function.ArgumentsHelper.getPositionalArguments(frame.getArguments());
assertEquals("One argument expected", 1, args.length);
var argType = TypeOfNode.getUncached().findTypeOrError(args[0]);
if (argType == ctx.getBuiltins().caughtPanic().getType()) {
if (argType == caughtPanic(ctx)) {
assertThat(args[0].toString(), Matchers.containsString("Thrown"));
return text;
} else {
Expand Down Expand Up @@ -114,7 +115,7 @@ public void catchAnyPanicSentinel() {
var args = Function.ArgumentsHelper.getPositionalArguments(frame.getArguments());
assertEquals("One argument expected", 1, args.length);
var argType = TypeOfNode.getUncached().findTypeOrError(args[0]);
if (argType == ctx.getBuiltins().caughtPanic().getType()) {
if (argType == caughtPanic(ctx)) {
assertThat(args[0].toString(), Matchers.containsString("Thrown"));
return text;
} else {
Expand All @@ -141,7 +142,7 @@ public void catchSpecificPanic() {
var args = Function.ArgumentsHelper.getPositionalArguments(frame.getArguments());
assertEquals("One argument expected", 1, args.length);
var argType = TypeOfNode.getUncached().findTypeOrError(args[0]);
if (argType == ctx.getBuiltins().caughtPanic().getType()) {
if (argType == caughtPanic(ctx)) {
assertThat(args[0].toString(), Matchers.containsString("Thrown"));
return text;
} else {
Expand Down Expand Up @@ -172,7 +173,7 @@ public void catchSpecificPanicSentinel() {
var args = Function.ArgumentsHelper.getPositionalArguments(frame.getArguments());
assertEquals("One argument expected", 1, args.length);
var argType = TypeOfNode.getUncached().findTypeOrError(args[0]);
if (argType == ctx.getBuiltins().caughtPanic().getType()) {
if (argType == caughtPanic(ctx)) {
assertThat(args[0].toString(), Matchers.containsString("Thrown"));
return text;
} else {
Expand Down Expand Up @@ -203,7 +204,7 @@ public void dontCatchSpecificPanic() {
var args = Function.ArgumentsHelper.getPositionalArguments(frame.getArguments());
assertEquals("One argument expected", 1, args.length);
var argType = TypeOfNode.getUncached().findTypeOrError(args[0]);
if (argType == ctx.getBuiltins().caughtPanic().getType()) {
if (argType == caughtPanic(ctx)) {
assertThat(args[0].toString(), Matchers.containsString("Thrown"));
return text;
} else {
Expand Down Expand Up @@ -239,7 +240,7 @@ public void dontCatchSpecificPanicSentinel() {
var args = Function.ArgumentsHelper.getPositionalArguments(frame.getArguments());
assertEquals("One argument expected", 1, args.length);
var argType = TypeOfNode.getUncached().findTypeOrError(args[0]);
if (argType == ctx.getBuiltins().caughtPanic().getType()) {
if (argType == caughtPanic(ctx)) {
assertThat(args[0].toString(), Matchers.containsString("Thrown"));
return text;
} else {
Expand All @@ -263,6 +264,10 @@ public void dontCatchSpecificPanicSentinel() {
}
}

private static Type caughtPanic(EnsoContext ctx) {
return ctx.getBuiltins().error().caughtPanic();
}

private static FunctionSchema schema(String argName) {
var def =
new ArgumentDefinition(0, argName, null, null, ArgumentDefinition.ExecutionMode.EXECUTE);
Expand Down
Loading
Loading