Commit Graph

1482 Commits

Author SHA1 Message Date
Dmitry Bushev
3749f1057e
Fix RuntimeAsyncCommandsTest (#11668)
Fixes occasional issues on CI https://github.com/enso-org/enso/actions/runs/12028665644/job/33537703634?pr=11663#step:7:3840
```
- should interrupt running execution context *** FAILED *** (2 seconds, 295 milliseconds)
0 did not equal 1 (RuntimeAsyncCommandsTest.scala:254)
```

The issue is caused by the asynchronous nature of the test. By the point when the interrupt command is sent the program is already terminated but the test assumes that the program is still running.
2024-11-26 15:33:08 +00:00
Jaroslav Tulach
e06e234d53
Robust again IllegalArgumentException (#11662) 2024-11-26 14:33:18 +01:00
Dmitry Bushev
3d6ca032de
Ydoc library (#11615)
`ydoc-server` compilation requires generation of `ydoc.cjs` resource that can take time and slow down the libraries development (building the enso distribution). This PR splits Ydoc into a library and the server part to avoid JS resources generation during the compilation of the language server.

Changelog:
- refactor: Ydoc into ~~`ydoc`~~ `ydoc-polyglot` library and  `ydoc-server` server parts
- update: language server to depend on the ~~`ydoc`~~ `ydoc-polyglot` library
2024-11-25 17:54:25 +00:00
Jaroslav Tulach
1cc3848c5a
Avoid exposing EnsoMultiValue getters (#11642)
Another step in the #11482 work. Avoid accessing internals of `EnsoMultiValue`. Use `TypeOfNode` methods (as provided by #11618) instead.
2024-11-25 13:14:11 +00:00
Dmitry Bushev
2b9ed57a95
Deliver full intersection type of a value to the IDE (#11583)
close #11481

Changelog:
- update: handle `MultiTypeValue` results in the execution instrument
- update: language server protocol supports multi-type values
- update: GUI uses only the first type of a multi-type value when

# Important Notes
GUI uses only the first type of the intersection. See the difference between `Integer&Text` and `Text&Integer`:

https://github.com/user-attachments/assets/29efc89b-c223-4043-8dff-9cdae1987f0c
2024-11-22 16:41:31 +00:00
Jaroslav Tulach
7c5e69219c
Giving TypeOfNode richer query API (#11618) 2024-11-22 07:58:30 +01:00
Dmitry Bushev
8930387693
Fix runtime-instrument-common benchmark (#11619) 2024-11-21 18:42:43 +00:00
Dmitry Bushev
3a4ac4f381
Fix compilation error in integration tests (#11611) 2024-11-21 09:59:39 +00:00
Jaroslav Tulach
afe4203f6a
Invoke Warning.getValue().to_text and use it from ReplDebuggerInstrument (#11591)
Fixes #11569 by using `.to_text` on the right _warning's value_ (as introduced by #10842) and sharing the code with the instrument.
2024-11-20 17:31:33 +00:00
Jaroslav Tulach
b3588490db
Give DebugBreakpointNode some section to prevent NPE (#11594)
Fixes `NullPointerException` by giving `DebugBreakpointNode` a source section.
2024-11-20 15:20:10 +00:00
Pavel Marek
04075c5ed7
Implement hasLanguage interop message for all enso objects (#11538)
* EnsoObject is an abstract class, not an interface.

- Also, EnsoObject exports hasLanguage and getLanguage interop messages.
- BranchRecord converted to class

* Implement public getters in BranchResult

* Fix compilation of EnsoFile

* Add test that all enso values must have language

* Revert EnsoException - remove

* DataflowError and PanicException implement hasLanguage and getLanguage

* DataflowError is not EnsoObject - change signatures in some builtins

* Add more members to Module.isMemberInvocable.

Keep in sync with doInvoke.

* Revert "DataflowError and PanicException implement hasLanguage and getLanguage"

This reverts commit b30f3961b7.

* Update the test - test only non-primitive and non-exception values

* Fix indexes in CodeLocationsTest

* Add more members to Function.isMemberInvocable

Keep in sync with doInvoke.

* EnsoObject.toDisplayString delegates to toString method

* EnsoObject.toDisplayString is behind TruffleBoundary

* Warning exports InteropLibrary which delegates to value.

With the exception of toDisplayString message.

* WithWarnings needs to explicitly export toDisplayString.

It is not automatically delegated because it is implemented in the super type.

* EnsoObject.toDisplayString just throws AssertionError

* AssertionError is behind TruffleBoundary

* Implement toDisplayString on some truffle objects

* Warning exports WarningsLibrary

* Revert "Warning exports WarningsLibrary"

This reverts commit a06c672db5.

* Add some warnings test

* Warning.isNull is always false

Even if it wraps Nothing

* Add some unnecessary methods to fix the compilation

* EnsoObject.toDisplayString is abstract

* ImportExportScope.toDisplayString is behind TruffleBoundary.

This fixes native-image build of engine-runner.

* Hide some toDisplayString methods behind TruffleBoundary

This fixes native-image build of engine-runner.
Bypassing failing test.
2024-11-20 13:23:33 +00:00
Jaroslav Tulach
d862a3cf08
HostValueToEnsoNode is not a builtin (#11593)
Bypassing failing check.
2024-11-20 08:15:36 +00:00
Jaroslav Tulach
ad9d0e5ab5
Allow (42 : Text & Integer) at the end of function (#11588)
Bypassing failing check.
2024-11-20 08:14:38 +00:00
Jaroslav Tulach
3d8a0e1b90
Multi value Complex test and robustness refactoring (#11525)
While working on #11482 and enhancing the tests suite with more tests based on `type Complex` a [getRootNode() did not terminate in 100000 iterations](https://github.com/enso-org/enso/pull/11525#issuecomment-2476171597) problem was discovered. Detailed investigation revealed that the existing `ReadArgumentCheckNode` infrastructure was able to create a **cycle** of parent pointers in the Truffle AST.

The problem was in intricate manipulation of the AST while rewriting internals in `ReadArgumentCheckNode`. This PR avoids such manipulation by _refactoring the type checking code_. `ReadArgumentNode` knows nothing about types anymore. When a type check is needed, `IrToTruffle` adds additional `TypeCheckValueNode.wrap` around the `ReadArgumentNode` - that breaks the **vicious circle**.

All the _type checks_ nodes are moved to its own package. All but one of the classes are made package private. The external API for doing _type checking_ is concentrated into `TypeCheckValueNode`.
2024-11-19 17:04:42 +00:00
Pavel Marek
9a49a02e3f
--jvm tries to find Java executable system-wide. (#11500)
Fixes `--jvm` option, given to the native image. This was failing on my machine, because when given `--jvm` option, the runner was trying to find the `java` executable from the distribution manager's runtime (on my system located in `~/.local/share/enso/runtime`) and it used the first runtime found. But the first runtime on my system is JDK 17.

The `--jvm` option now tries to:
- Find a JDK from the distribution manager that has the same version as the JDK used for building the engine.
- If there is not an exact version match, it tries to find a runtime from distribution manager that is *newer*.
- If none, fallback to system-wide search
- System-wide search tries to find `java` from `$JAVA_HOME` and from `$PATH`. But this is just a fallback.

# Important Notes
- Added test to Engine CI jobs that pass `--jvm` argument to a native image of engine-runner
- ea3af5ffbc
- `runtime-version-manager` sbt project migrated to a JPMS module
- `engine-runner` now depends on `runtime-version-manager`.
- Removed unnecessary stuff in `runtime-version-manager` dealing with outdated `gu` Graal Updater utility.
- Extracted [GraalVersionManager](1455b025cb/lib/scala/runtime-version-manager/src/main/java/org/enso/runtimeversionmanager/components/GraalVersionManager.java) from [RuntimeVersionManager](d2e8994700/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/RuntimeVersionManager.scala)
2024-11-18 22:44:54 +00:00
Dmitry Bushev
6b810ee1e6
Rename unqualified method calls (#11556)
close #11281

Changelog:
- update: `refactoring/renameSymbol` can rename unqualified method calls

# Important Notes
https://github.com/user-attachments/assets/e03c4ec7-7620-4ce4-8eab-86b95f308be2
2024-11-15 13:10:57 +00:00
Hubert Plociniczak
e325e65524
Revert disabling of polyglot Ydoc (#11544)
This reverts commit e6a6308145.
This reverts commit f27e757e53.
This reverts commit 9b4134240a.
2024-11-13 16:04:13 +01:00
Hubert Plociniczak
2f2eeafceb
Fix Logger's name in stdlib (#11519)
* Fix Logger's name in stdlib

Somehow SLF4J is able to recognize correctly the provided Logger's name
and print it to the user. Java's Logger is
not.
In addition, we setup SLF4J's configuration, meaning that log-levels are
correctly respected.

For a simple project:
```
from Standard.Base import all
from Standard.Base.Logging import all

type Foo

main =
    IO.println "Hello World!"
    Foo.log_message level=..Warning "I should warn you about something..."
    Foo.log_message level=..Info "Should be seen? By default we only show up-to warnings level"
    Foo.log_message level=..Severe "Something went really bad!"
```

This change demonstrates the fix.

Before:
```
> enso --run simple-logging.enso
Hello World!
Nov 08, 2024 6:08:07 PM com.oracle.truffle.host.HostMethodDesc$SingleMethod$MHBase invokeHandle
WARNING: I should warn you about something...
Nov 08, 2024 6:08:07 PM com.oracle.truffle.host.HostMethodDesc$SingleMethod$MHBase invokeHandle
INFO: Should be seen? By default we only show up-to warnings level
Nov 08, 2024 6:08:07 PM com.oracle.truffle.host.HostMethodDesc$SingleMethod$MHBase invokeHandle
SEVERE: Something went really bad!
Foo
```

After:
```
> enso --run simple-logging.enso
Hello World!
[WARN] [2024-11-08T18:03:37+01:00] [simple-logging.Foo] I should warn you about something...
[ERROR] [2024-11-08T18:03:37+01:00] [simple-logging.Foo] Something went really bad!
Foo
```

* Update distribution/lib/Standard/Base/0.0.0-dev/src/Logging.enso

Co-authored-by: Radosław Waśko <radoslaw.wasko@enso.org>

* Test stdlib logs by using MemoryAppender

Added `getEvents` member to `MemoryAppender` so that it is possible to
retrieve individual log messages from tests and test their presence.
Required opening up to some modules to retrieve internals of loggers.

* nit

* small tweaks to eliminate module warnings

---------

Co-authored-by: Radosław Waśko <radoslaw.wasko@enso.org>
2024-11-13 10:20:41 +01:00
Paweł Grabarz
a83297b7db
Drop git dependency on enso-bot repository (#11539) 2024-11-12 18:25:19 +00:00
Jaroslav Tulach
67db825587
MetadataStorage is mutable - structural equals in copy isn't enough (#11513)
`MetadataStorage` is mutable. Using `Object.equals` in `IR.copy` methods to check whether a _copy is needed_ isn't enough. The fact that two storages are `Object.equal` may be just temporary. Replacing the checks in 69 `IR.copy` methods with identity check - e.g. `ne` in Scala which is `==` in Java.

Using proper structural check inside of `MetadataStorage` fixes #11171.

# Important Notes
I [used this regex](https://github.com/enso-org/enso/issues/11171#issuecomment-2463908932) to find out 69 instances of `IR.copy`:

![69 copy methods](https://github.com/user-attachments/assets/257580b9-54fc-4199-88ad-a22103b0041f)

and I modified all 69 of them.
2024-11-08 17:29:41 +00:00
Jaroslav Tulach
a6460c17b2
Implement proper hash and equals for FrameVariableNames (#11512) 2024-11-08 16:25:28 +01:00
Hubert Plociniczak
a5ebdf4e79
Fix logging in CLI (#11472)
* Fix logging in CLI

Previously, unless `--logger-connect` was used, CLI would always
fallback to console logging. In addition it would be misconfigured if
`application.conf` was provided with logging configuration.

This change makes sure that CLI uses the same logging infrastructure as
the rest of the system.
As a result, CLI will now by default not only log to the console and
respect the provided configuration but also log to the file system.

* Update docs

* c&p error

* More examples
2024-11-07 16:03:19 +01:00
Pavel Marek
701bba6504
Convert Array_Like_Helpers.map to a builtin to reduce stack size (#11363)
The ultimate goal is to reduce the method calls necessary for `Vector.map`.

# Important Notes
- I managed to reduce the number of Java stack frames needed for each `Vector.map` call from **150** to **22** (See https://github.com/enso-org/enso/pull/11363#issuecomment-2432996902)
- Introduced `Stack_Size_Spec` regression test that will ensure that Java stack frames needed for `Vector.map` method call does not exceed **40**.
2024-11-06 11:14:48 +00:00
Jaroslav Tulach
73abe909ef
Use GraphBuilder to construct an alias Graph (#11491) 2024-11-05 18:56:05 +01:00
Hubert Plociniczak
35e5ed53d2
Don't cancel aborted jobs immediately (#11375)
* Don't cancel aborted jobs immediately

Rather than cancelling Futures that capture jobs' logic,
this change introduces a two-level system:

- interrupt all jobs softly via ThreadInterrupted at safepoints
- if safepoint is not executed within some time period or it is
  but the job is still not cancelled, trigger a hard-interrupt
  by cancelling the job explicitly, if possible

Closes #11084.

* Only cancel Future when you mean it

Soft-cancelling a future only to later call it with `mayInterrupt` set
to `true` has no effect in the latter case.
Changed the logic so that interrupting a Future will really enforce it.

Ocassionally some commands should not attempt to run soft cancellations
- we know they will re-execute the program.

* Replace Thread.sleep with Future.get

No while loops etc, it's much easier to reason about what is soft and
hard interrupt supposed to do.

* Better comments/logs

* nit

* PR review

* Make test more robust
2024-11-05 10:33:02 +01:00
Jaroslav Tulach
988316f910
Make Graph.nextId() private (#11486) 2024-11-05 05:21:10 +01:00
Jaroslav Tulach
dd107e0ab1
Ensure EnsoMultiValue returns some Meta.type_of (#11480) 2024-11-04 20:47:25 +01:00
Kaz Wesley
2b3bd2cc90
Move documentation into documentable types (#11441)
Move documentation into documentable types (implements #11302).

# Important Notes
GUI:
- Distinguish expression and statement
- `Ast.Ast` is still present, as the base class for AST objects. Most references to `Ast.Ast` are now references to `Ast.Expression`. Operations on blocks use `Ast.Statement`.
- `Ast.parse` has been replaced with: `Ast.parseExpression`, `Ast.parseStatement`, and `Ast.parseBlock`
- `syncToCode` is internally context-aware; it parses the provided code appropriately depending on whether its AST is an expression, a statement, or the top level of a module.
- Remove `wrappingExpression` / `innerExpression` APIs: Wrapper types have been eliminated; modifier lines are now fields inside parent types.
- Simplify AST printing:
- Fully implemented autospacing in `concreteChildren` implementations; the type returned by `concreteChildren` now ensures that spacing has been fully resolved.
- Eliminate `printBlock` / `printDocs`: `concreteChildren` is now aware of indentation context, and responsible for indentation of its child lines.
- The `Pattern` type is now parameterized to identify the AST type it constructs. The `Pattern.parseExpression` function helps create a `Pattern<Expression>`.
- Refactor `performCollape` for testability.
- e2e tests: Improve table viz test: It still doesn't pass on my Mac, but these changes are necessary if not sufficient.

Compiler (TreeToIr):
- An expression in statement context is now found in an `ExpressionStatement` wrapper.
- Documentation for a `Function` is now found inside the function node.
- Deduplicate some polyglot-function logic.
2024-11-04 15:33:53 +00:00
Jaroslav Tulach
4cb943b5ed
Occurences in Java. Don't expose setters for Scope vars. (#11464)
Another change motivated by work on #11365. Continuation of #11419.
2024-11-01 17:14:10 +00:00
Pavel Marek
536a49f35d
Fix Meta.get_qualified_type_name when run as single file (#11401)
`Meta.get_qualified_type_name` correctly returns fully qualified type name when running a single file from a project with `enso --run Proj/src/Main.enso`.
2024-10-31 15:25:45 +00:00
James Dunkerley
610ee5fdec
Expand and improve pretty for core data types, vector and table. (#11438)
-  Alter default `Any.pretty` so constructor is prefixed with type name (as needed now).
![image](https://github.com/user-attachments/assets/72d5ff2f-b567-47e2-becf-2e4acd4d089d)
-  Tests for `pretty` on `Date`.
- `pretty` for  `Date_Time` and  `Time_Of_Day` improved to not have as much noise.
- `pretty` for  `Period`,  `Date_Range` and  `Range`.
- Added custom `pretty` for  `Vector` and  `Array` as built-in method doesn't call through to overrides.
- Added custom `pretty` for  `Column` and  `Table`.
- Bug fix for `pretty` in `Time_Zone` so calls through to `pretty` of the zone_id to ensure safely escaped.
- Initial `default_widget` for `Date` and `Time_Of_Day`.
- Improve widget for `Date.to_date_time`.
![image](https://github.com/user-attachments/assets/18bc1d88-8ea9-42d0-8a9c-bc873e5d6835)
- `to_text`, `to_display_text` and `pretty` for `Enso_Secret`
![image](https://github.com/user-attachments/assets/d850c109-d1af-4b6f-a450-013c4d137805)
- private constructor for `Enso_Secret` as can't be correctly built directly.
- Use `_` for the testing methods in `HTTP` to clarify they shouldn't be used in general code.
2024-10-31 10:04:52 +00:00
Dmitry Bushev
74220f243a
Dependency tracking between nodes is too coarse grained (#11428)
close #11237

Changelog:
- update: implement special case for a line removal when calculating the changeset

# Important Notes
Note that the graph is still re-calculated when the node is re-added (by pressing `ctrl-z`). The reason is that the engine processes edits on the textual level and there is not enough information to do similar workarounds. The issue becomes irrelevant when we switch to the direct tree manipulation in Ydoc.

https://github.com/user-attachments/assets/c85afde8-6386-44df-82b5-6fb0cca5205b
2024-10-29 15:33:53 +00:00
Jaroslav Tulach
15575b495a
Skeletal PanicExceptionTest and more logging when AssertionError happens (#11393) 2024-10-29 15:47:12 +01:00
Jaroslav Tulach
71acb83e7f
Removing useless GraphOccurrence.Global & some encapsulation (#11419)
Work on #11365 made me realize that `GraphOccurrence.Global` isn't really used anywhere. Simplifying the code by removing it and associated methods.
2024-10-29 10:23:22 +00:00
Dmitry Bushev
d16fd63525
Reload insight script on file change (#11415)
Changelog:
- update: reload insight script when the file was edited
2024-10-28 09:17:53 +00:00
Jaroslav Tulach
48984454e3
Testing current behavior of if/then/else (#11395)
Related to #9165 work. Let's make sure the current behavior of `if`/`then`/`else` is properly tested by a unit test. Extracting test created as part of #11365 to verify it really describes the current behavior.
2024-10-24 15:03:41 +00:00
Jaroslav Tulach
fe45da98d7
Use enso.dev.insight property to turn Insight on (#11385) 2024-10-24 13:56:28 +02:00
Pavel Marek
c8393095b5
Speedup DataflowError.withDefaultTrace (#11153)
Improves the speed of `ExecutionEnvironment.hasContextEnabled`.

# Important Notes
Local speedup of `Map_Error_Benchmark_Vector_ignore.Map_Id_All_Errors` benchmark is roughly ???.
2024-10-24 03:00:38 +00:00
Kaz Wesley
33904912ee
Move annotations into fields of Function and ConstructorDefinition (#11374)
Move annotations into fields of Function and ConstructorDefinition.

# Important Notes
New syntax: Constructor argument-definition lines
- Each argument in a type-constructor definition may be specified on its own (indented) line.

Relaxed syntax: Unparenthesized arguments to annotations
- A generic annotation now uses the rest of the line as its argument expression; the expression no longer needs to be parenthesized.
2024-10-23 20:35:06 +00:00
Jaroslav Tulach
c460342f74
Simplify IGV graph by trimming nodes for code paths that rarely happen (#11381)
Simplifies the IGV graph by removing nodes that shouldn't be there during "normal" execution.
2024-10-23 15:30:48 +00:00
Hubert Plociniczak
b99aa668ef
Fail gracefully when a job is already rejected (#11361)
Noticed a random failure in our tests:
```
  pw:browser [pid=2812009][out] [INFO] [2024-10-16T19:56:04.195] [org.enso.languageserver.protocol.json.JsonConnectionController] Session terminated [1e652e5e-9953-480a-8220-c4b4f068379a]. +32ms
  pw:browser [pid=2812009][err] java.util.concurrent.RejectedExecutionException: Task Future(<not completed>) rejected from java.util.concurrent.ThreadPoolExecutor@6846840b[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 2] +40ms
  pw:browser [pid=2812009][err] 	at java.base/java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2081) +1ms
  pw:browser [pid=2812009][err] 	at java.base/java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:841) +0ms
  pw:browser [pid=2812009][err] 	at java.base/java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1376) +0ms
  pw:browser [pid=2812009][err] 	at scala.library@2.13.11/scala.concurrent.impl.ExecutionContextImpl.execute(ExecutionContextImpl.scala:21) +0ms
Error: 1mpw:browser [pid=2812009][out] [ERROR] [2024-10-16T19:56:04.197] [enso.org.enso.interpreter.service.ExecutionService] An error occurred during execution of AttachVisualizationCmd(visualizationId: 97ea02c1-10fa-4e1a-bd8f-bd03a2c36146,expressionId=fcf199e6-d2b1-44b7-be92-a47545d6a593) command +21ms
  pw:browser [pid=2812009][out] scala.MatchError: null +0ms
  pw:browser [pid=2812009][out] 	at org.enso.runtime.instrument.common/org.enso.interpreter.instrument.command.AttachVisualizationCmd.$anonfun$executeCmd$1(AttachVisualizationCmd.scala:45) +0ms
  pw:browser [pid=2812009][out] 	at scala.library@2.13.11/scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470) +0ms
  pw:browser [pid=2812009][out] 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) +0ms
  pw:browser [pid=2812009][out] 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) +0ms
  pw:browser [pid=2812009][out] 	at java.base/java.lang.Thread.run(Thread.java:1583) +0ms
  pw:browser [pid=2812009][out] 	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread.access$001(PolyglotThread.java:53) +0ms
  pw:browser [pid=2812009][out] 	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThread$1.execute(PolyglotThread.java:106) +0ms
```
2024-10-23 11:55:05 +02:00
Kaz Wesley
4e4a1e1df2
Move TypeSignature into field of Function (#11364)
Move type-signature lines into `Function` field. Also implements #11293.

Stacked on #11346.
2024-10-22 19:50:14 +00:00
Kaz Wesley
d278ad636c
Replace private modifier node with field on supporting types (#11346)
Eliminate `private` modifier-node: `private` is a field in supporting types, or a single-token node in the case of `private` declarations.

# Important Notes
- Rust parser tests: Switch to a builder-style API for defining expected `Function` ASTs to allow further changes to `Function` fields without rewriting all the tests again.
- TreeToIr: Fix discarded module-level `diag`; add a test that covers module diagnostics.
- Syntax: Disallow `private` methods in function blocks. (Previously this was enforced in the compiler.)
2024-10-22 16:26:00 +00:00
Jaroslav Tulach
a5b223f33b
Benchmark time it takes compile Standard.Base library (#11355)
Benchmark time it takes to `enso --compile ... Standard/Base` library before speeding it up by [caching libraryName of ImportTarget](43021fcef0).
2024-10-21 14:34:38 +00:00
Dmitry Bushev
1fbaeaa767
Unblock the hooks execution (#11359)
close #11231

Changelog:
- fix: do not block during the hooks execution
2024-10-20 18:25:21 +00:00
Hubert Plociniczak
c6ec5c5399
Handle autoscoped constructor args with no UUID (#11354)
* Handle autoscoped constructor args with no UUID

An application involving >1 autoscoped atom constructor arguments
with no ID would lead to a silent type error in GUI. It was silent
because once IdMap gets updated, the original type error disappears and
users are left with a No_Such_Method on a Panic.

The type error may occur because the compiler was inferring the same
UUID for autoscoped constructors. Args with UUID are cached therefore a
type confict might occur on the second (or later) argument.

Added a unit test case demonstrating the problem (previously it would
fail). The search path is now a bit more careful when inferring
arguments.

* One more test
2024-10-18 20:43:18 +02:00
Kaz Wesley
4d4a2990a0
Distinguish assignment/thunk by statement context (#11324)
Align `Assignment`/`Function` distinction in AST with compiler's implemented semantics:
- The ambiguous case `funcOrVar = expression` is now parsed as a `Function` when in a `Type` definition or in the top level of a module. I.e. it is an `Assignment` in contexts where the RHS is evaluated immediately when the binding is evaluated, and a `Function` in contexts where the RHS is evaluated each time the bound name is evaluated.
- `Assignment` statements now may only occur in function bodies.

Correcting this distinction lays the groundwork for #11302.

Other changes:
- Fixed incorrect source code locations for negative literals and negated expressions.

# Important Notes
New APIs:
- The parser now exposes a `parse_block` entry point, which allows parsing input lines as if in the body of a function. The previous entry point has been renamed to `parse_module`.
2024-10-18 17:54:55 +00:00
Jaroslav Tulach
6a506161cb
Make sure unrecognized CLI command message is printed (#11357) 2024-10-18 17:13:02 +02:00
Dmitry Bushev
7522acf925
Node added inside collapsed node is never executed (#11341)
close #11251

Changelog:
- add: `CachePreferences` configuration of the expressions that are marked for caching
- update: Invalidate the `self` keywords in the parent frames on function edit
- update: persistance config

# Important Notes
The demo shows that:

1. The new node created in the collapsed function is highlighted (GUI receives the expression update)
2. When the collapsed function is edited, the nodes in the `main` method are updated correctly

https://github.com/user-attachments/assets/41c406ed-ba76-41c8-9e3f-89ac9ff63c3f
2024-10-18 14:19:50 +00:00
Pavel Marek
f470e9c63c
Set live execution environment for REPL (#11353) 2024-10-18 12:07:26 +02:00