Commit Graph

1297 Commits

Author SHA1 Message Date
Radosław Waśko
3b566709f3
Type Inference PoC - iteration 1 - most basic type inference (#8652)
- Closes #8590
2024-06-13 16:23:56 +00:00
Hubert Plociniczak
d6d370925a
Removing dependencies to speed up startup (#10249)
Reducing the number of dependencies. Explicit `cats` are almost gone (present in `cli`). `enumeration` is completely gone.  `cats` is also still included implicitly via `io.circe` but that's a different kind of beast.
Also, really removed `jackson` from dependencies by fixing the dependency on `http-test-helper`.

# Important Notes
In a number of places importing all cats implicits could be simply replaced with a single or two method calls. Not to mention that this will reduce compilation times due to reduced implicit search space.

One example of how the changes affect performance (not only startup):

Before:
![Screenshot from 2024-06-11 12-05-24](https://github.com/enso-org/enso/assets/292128/a1a772a9-635d-4a16-a543-e2fd2124a22c)
Now:
![Screenshot from 2024-06-11 14-27-47](https://github.com/enso-org/enso/assets/292128/b17c7fcc-9a6d-48b9-8200-60708354ee03)
(frequently executed)

![Screenshot from 2024-06-12 12-46-34](https://github.com/enso-org/enso/assets/292128/31bc4dfd-4edc-45c9-9c5d-13e3472089b9)
Also appears to be gone.

This PR is by no means finished. The purge will continue in follow up PRs.
2024-06-12 18:15:36 +00:00
Jaroslav Tulach
5339484285
shouldCreateClosureRootNode when valueHasSomeTypeCheck (#10262)
Fixes #10236.
2024-06-12 14:04:50 +00:00
Jaroslav Tulach
87864bf564
Presence of Any disables type checks (#10248)
Fixes #10237 by avoiding creation of `ReadArgumentCheckNode` when the requested type allows `Any`.
2024-06-12 11:10:23 +00:00
Radosław Waśko
c4b0ca8f69
Ensure type ascriptions are correctly transformed to facilitate checking of more complex return types (#10229)
- Fixes #9980
- Adds some tests to ensure types like `|` or `&` (in addition to `!` from the ticket) correctly work in return type check.
- Fixes a weird behaviour where we used to avoid processing type related IR transformations inside of type ascriptions.
- Adds parentheses to type representations if they are more complex: `A | B & C` is unclear as it can either mean `A | (B & C)` or `(A | B) & C` which have different meanings. If we now have an operation with such nesting, the sub expressions are wrapped in parentheses to disambiguate.
2024-06-11 17:11:03 +00:00
Hubert Plociniczak
4da5e611c9
Replace Jackson serde (#10035)
JSON serialization setup between Language Server and Runtime is a major contributor to startup time. This PR experiments with an alternative implementation that remedies the problem.
The new serializer uses [jsoniter-scala](https://github.com/plokhotnyuk/jsoniter-scala) which by some accounts claims to be really fast. In our case, more importantly, we pay negligible cost of startup setup compared to Jackson which was horribly slow.

# Important Notes
Before:
![Screenshot from 2024-06-06 15-35-18](https://github.com/enso-org/enso/assets/292128/56103b82-777e-459f-966e-abdef25c2430)
After:
![Screenshot from 2024-06-06 15-35-02](https://github.com/enso-org/enso/assets/292128/00a36647-dfae-4dc8-a1b7-bf69069ef109)

Yes. About 0.8sec.
2024-06-11 15:03:12 +00:00
Jaroslav Tulach
aaaebcabf8
Implement and benchmark ArrowOperationPlus node (#10150)
Prototype of #10056 showing `+` operation implemented in the _Arrow language_.
2024-06-11 12:50:59 +00:00
Pavel Marek
5fa29c51b5
Fix Meta.enso_project (#10192)
Fixes `Standard.Base.Meta.Enso_Project.enso_project` to return a project descriptor for the *main* project, i.e., the one configured as a *root* for the engine.

# Important Notes
`enso_project` builtin no longer iterates the stack frames to infer the project descriptor. It derives it from the default package repository.
2024-06-11 08:31:40 +00:00
Radosław Waśko
99a1d052a0
Fixes to Persistance (#10101)
- Follow-up to #9361
- Enables assertions and fixes `count` check
- Tests and fixes null references
- Tests and fixes serializing a deserialized structure - by saving the id of the `Persistance` corresponding to the entry
- After the change to how we determine which `Persistance` instance to use, the most specific one is now used (based on the saved id). This has an unfortunate consequence that `Seq` which is most of the time represented by a subtype of `List`, is now using `PersistScalaList` which is not lazy.
- To alleviate that, we no longer use `Seq` to store some field lazily and instead use a dedicated type for that purpose: `InlineReference`.
2024-06-10 11:49:12 +00:00
James Dunkerley
d938c96c55
Adding type annotations and enabling auto-scoping (#10173)
- Renamed `Missing_Required_Argument` to `Missing_Argument`, and added `throw` method.
- Add default widget to `Case_Sensitivity.Insensitive locale`.
- Switch to auto scoping for `parse_type_selector`.
- Add type annotation to various simple typed arguments in `Table` and `DB_Table`.
- Altered `Filter_Condition` to have `Missing_Argument` for all non-defaulted arguments.
- Added resolution of `Column_Ref` passed as auto-scoped to `Table_Ref`.
- Altered `Simple_Calculation` to have `Missing_Argument` for all non-defaulted arguments.
- Altered `Join_Condition` to have `Missing_Argument` for all non-defaulted arguments.
- Altered `Sort_Column` to have `Missing_Argument` for all non-defaulted arguments.
- Altered `Aggregate_Column` to have `Missing_Argument` for all non-defaulted arguments.

**rename_columns:**
![image](https://github.com/enso-org/enso/assets/4699705/08aaba0f-687a-450c-9781-8eadc062bd50)

**aggregate:**
![image](https://github.com/enso-org/enso/assets/4699705/c29e7944-1a1c-4020-9fe0-528d874b8049)

**join:**
![image](https://github.com/enso-org/enso/assets/4699705/50038166-e56d-48c5-9eeb-bd46fa415e46)

**set:**
![image](https://github.com/enso-org/enso/assets/4699705/bee2462a-dafb-4bd4-b102-ec73edb4fb93)
2024-06-10 07:52:32 +00:00
Dmitry Bushev
292d33ccc1
Fix refactor/renameProject with names containing unsupported characters (#10204)
related #10073

Changelog:
- fix: rename the project to the name containing unsupported characters
2024-06-07 12:34:01 +00:00
Pavel Marek
2ea2a57651
ydoc-server is a separate module (#10156)
- Remove remnants of deprecated Scala parser
- The following projects are now JPMS modules provided on system module-path (in components directory):
  - `ydoc-server`
  - `profiling-utils`
  - `syntax-rust-definition`
- The contents of the aforementioned modules are excluded from both `runner.jar` and `runtime.jar` fat jars.
- Suggestions are serialized and deserialized with our Persistance framework, rather than via the default Java OutputObjectWriter.
2024-06-07 12:56:42 +02:00
Jaroslav Tulach
396d70ddc0
Execute foreign function and check autoscoped constructor result (#10187)
Fixes #10151 and also fixes #10180 and fixes #10186.
2024-06-06 13:16:27 +00:00
Hubert Plociniczak
1bc14252df
Extract mutable builder from ModuleScope (#9914)
Refactored mutable parts of `ModuleScope` into builder to make it easier to reduce unnecessary locks.

# Important Notes
Elements of ModuleScope (types, imports etc) are used while _building_ of it may still be in progress. In order to make static typing happy, every `ModuleScope.Builder` can be exposed as (unmodifiable) `ModuleScope`.
2024-06-05 16:57:08 +00:00
Jaroslav Tulach
8332118ff4
What's the name of my method? (#10164)
While working on #10056 I realized the names of method and closure nodes are incomprehensible to anyone. This PR replaces the infamous `<anonymous>` with a name hinting where the method actually is.

# Important Notes
I assume this change will be visible not only in IGV, but also in _stacktraces_ and we may need to adjust few tests.
2024-06-05 07:49:53 +00:00
GregoryTravis
1c2955655c
Add no_warning_propagation flag to Vector.build and Builder.new (#10079)
* no_warning_propagation flag

* doc

* benchmarks

* change to propagate_warnings, test

* fix java benchmark

* add benchmark to main
2024-06-04 09:06:09 -04:00
Dmitry Bushev
d08cb704b0
Record interaction between GUI and LS (#10107)
close #8328

Changelog:
- add: message callbacks to JsonRpc and Binary servers
- update: use events log to collect the RPC messages
2024-06-03 06:50:59 +00:00
Jaroslav Tulach
9632f04e9b
Directly allocate warnings asVectorEnsoObjects (#10143) 2024-06-01 06:23:49 +02:00
AdRiley
af4177e61f
Make table default visualisation (#10128)
Makes table the default vis type.

Before:
![image](https://github.com/enso-org/enso/assets/1720119/8a5d113a-ac06-4dd8-afdb-151cdbc149ab)

After:
![image](https://github.com/enso-org/enso/assets/1720119/d7c33cf7-355d-4517-8967-1963ff506f97)

Closes #10093
2024-05-31 15:02:02 +00:00
Pavel Marek
270f708e4f
Implement private methods (#10060)
Add support for private methods. Most of the changes are in parser and compiler. The runtime checking of private functions was already present since #9692

# Important Notes
- Only top-level methods can be declared `private`.
- private method cannot be called from different project
- private method cannot be accessed from polyglot code (private method does not exist for polyglot code)
2024-05-31 08:00:20 +00:00
Jaroslav Tulach
c4bf9182aa
Give qualified name of type a location (#10138)
Tests and fixes #9084.
2024-05-30 19:15:46 +00:00
Dmitry Bushev
f83ae1382e
Temporarily disable Ydoc startup (#10141)
related #10134
2024-05-30 16:28:16 +00:00
Jaroslav Tulach
b2cf2f75fb
Extract the State from thunk's scope (#10120) 2024-05-30 17:24:06 +02:00
Pavel Marek
56b289ae79
Move common testing functionality to a separate project (#10112)
Introduce a new `test-utils` project, and moves the `TestBase` there. Moreover, `TestBase` is renamed to `TestUtils` and is no longer an abstract class.

# Important Notes
`test-utils` project does not depend on junit, so it can be used, for example, by any benchmarks as well.
2024-05-29 11:50:03 +00:00
Jaroslav Tulach
6897f0d30c
Suspended arguments need one more child scope (#10104) 2024-05-28 17:53:08 +02:00
Dmitry Bushev
858e646328
Start Ydoc with the language server (#9862)
- related #7954

Changelog:
- update: Ydoc starts with the language server on the `localhost:1234` by default. The hostname and ports can be configured by setting environment variables `LANGUAGE_SERVER_YDOC_HOSTNAME` and `LANGUAGE_SERVER_YDOC_PORT`
- update: by default `npm dev run` uses the node Ydoc server. You can control it with `POLYGLOT_YDOC_SERVER` env variable. For example,
```
env POLYGLOT_YDOC_SERVER='true' npm --workspace=enso-gui2 run dev
```
To connect to the Ydoc server running on the 1234 port (the one started with the language server)
⠀
```
env POLYGLOT_YDOC_SERVER='ws://127.0.0.1:1235' npm --workspace=enso-gui2 run dev
```
To connect to the provided URL. Can be useful for debugging when you start a separate Ydoc process.
- update: run `npm install` before the engine build. It is required to create the Ydoc JS bundle.
2024-05-28 13:51:42 +00:00
Hubert Plociniczak
8f9fc0822c
Avoid out-of-context interrupted lock exceptions (#10095)
This change is a re-do of old PR https://github.com/enso-org/enso/pull/8270 that has been abandoned a while ago.

The change attempts to address to case of random `InterruptedExceptions` that can result when a task is interrupted while waiting on a lock. In comparison to the original PR, this change introduces `withXYZLock` methods with a `Callable` parameter. As a result we ensure correct acquisition/release semantics, logging and handling of interruptions.

# Important Notes
https://github.com/enso-org/enso/pull/8270 was too much hassle to rebase against latest develop.
2024-05-28 08:50:21 +00:00
Jaroslav Tulach
921870f12b
Reactive RuntimeCache (#10065) 2024-05-27 10:52:58 +02:00
Dmitry Bushev
a269ad3582
Removing last node from main graph makes execution error (#10048)
close #9172

Changelog:
- update: insert `Empty` IR node for the empty method definition bodies
- update: generate node resulting in `Nothing` for `Empty` IR nodes
- refactor: remove redundant checked exceptions in `EnsoParserTest`
2024-05-24 14:11:06 +00:00
Hubert Plociniczak
495eed45ba
Turn strict errors off for Language Server (#10061)
Ensure strict errors are off to prevent unrecoverable errors in IDE.
Also partially reverted a change that prevented application of changes on errors (errors are still logged, as intended).
Closes #10014.
2024-05-23 20:49:08 +00:00
Dmitry Bushev
4ca26c84ef
Filter private constructors from Suggestions Database (#10032)
close #10011

Changelog:
- feat: exclude private constructors from Suggestions database

# Important Notes
`java_table` field of the `Table` is hidden

![2024-05-22-084751_892x913_scrot](https://github.com/enso-org/enso/assets/357683/4770e173-f5af-4726-a7fc-2dab1ef3eea5)
2024-05-23 06:48:29 +00:00
Jaroslav Tulach
16c1b74218
Enso Library Feature to execute (a bit of) Base_Tests (#9997) 2024-05-23 08:20:19 +02:00
Pavel Marek
ba2787c4d2
Ensure disable private check cmd line option disables runtime private access checks (#10034)
Ensure that `--disable-private-check` cmd line option disables the runtime private access checks as well.
2024-05-22 16:35:24 +02:00
Pavel Marek
202f7e1a49
Conflicting extension methods result in compilation failure (#9844)
Fixes the non-deterministic method resolution in cases when the method is defined multiple times in imported modules.
2024-05-22 13:49:23 +02:00
Jaroslav Tulach
befd938dbf
Use proper Java class name in error message (#9996)
Better error message when static method cannot be found on a Java class.
2024-05-20 15:03:04 +00:00
Dmitry Bushev
643b66d0b7
Allow file/read to return the contents of a collaborative buffer (#9994)
part of #9960

Changelog:
- feat: file/read return contents of a collaborative buffer if they are available and fallback to reading the file from disk
2024-05-20 14:01:59 +00:00
Jaroslav Tulach
fe28c23658
Table of Persistance.Reference at the end of the stream (#9972)
Fixes #9361 by delaying storing of `Persistance.Reference` instances and creating their table at the end of the stream.
2024-05-18 17:33:04 +00:00
GregoryTravis
4d49b00375
Combine builders for Vector.build and Vector.new_builder (#9922)
We have decided to keep the old new_builder, and to combine the new and old builders into one builder.
2024-05-17 16:18:47 +00:00
Jaroslav Tulach
5c06535c46
Importing (some of) Standard.Base works from NI runner (#9866) 2024-05-17 14:42:35 +02:00
Hubert Plociniczak
a5ca9f9ac2
Reduce ops when setting exisitng execution env (#9967)
Setting execution environment to the existing one should have no effect.
Should (positively) affect startup in #9789.

# Important Notes
Cancelling jobs and triggering a fresh execute job is expensive and unnecessary, especially on startup, when the result should be the same as before.
2024-05-16 20:59:13 +00:00
Hubert Plociniczak
f1e60e7e44
Use simple type name as Jackson type id (#9961)
Using a fully qualified name for type identifier does not play well when dealing with different classloaders (classes are not recognized as equal/subtypes).

Closes #9876. Likely also affecting #9306.

# Important Notes
There appears to be a number of cases loosely related issues on that subject. Gave up on adding a test cases to simulate the problem but I could no longer reproduce it with LS/runtime on a live project.
```
[org.enso.languageserver.runtime.RuntimeConnector$Endpoint] Failed to deserialize runtime API envelope
com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'org.enso.polyglot.data.Tree$Node' as a subtype of `org.enso.polyglot.data.Tree$Node<org.enso.polyglot.runtime.Runtime$Api$SuggestionUpdate>`: Not a subtype
at [Source: (byte[])[6718 bytes]; byte offset: #394] (through reference chain: org.enso.polyglot.runtime.Runtime$Api$Response["payload"]->org.enso.polyglot.runtime.Runtime$Api$SuggestionsDatabaseModuleUpdateNotification["updates"]->org.enso.polyglot.data.Tree$Root["children"]->com.fasterxml.jackson.module.scala.deser.GenericFactoryDeserializerResolver$BuilderWrapper[0])
at org.enso.IsolatedClassLoader//com.fasterxml.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:43)
```
appears to be gone.
2024-05-16 14:26:26 +00:00
Jaroslav Tulach
a53b2f0b18
Reverse order of stack frames and test the result (#9954)
Fixes #9934 by reversing the order of `dropInitJava` frames.
2024-05-15 09:09:36 +00:00
Hubert Plociniczak
c67218c1ed
Abort jobs as early as possible (#9927)
We don't seem to run `abortJobs` under a lock, and especially not under the write compilation lock, in other scenarios. This is causing some major slowdown when there is a long running execution or compilation, as currently experienced in the cloud.

This should reduce chances of a timeout.

Also added an option to override the global executor. Currently it would always default to the runtime number of available process which may be suboptimal.

# Important Notes
Pending testing on the impact it will have.
2024-05-13 07:39:29 +00:00
Hubert Plociniczak
f1ddf1b863
Log timings of FS operations (#9908)
I'm seeing occasional IO timeouts, especially on startup operations, for cloud projects. Adding some logging to make an informed decision if there are some problems there.

Related to https://github.com/enso-org/enso/issues/9789

# Important Notes
Also added retries when closing the file as I saw a number of times:
```
Session release failed.
LsRpcError: Language server request 'text/closeFile' failed.
at LanguageServer.request (/tmp/.mount_enso-leMqqdS/resources/app.asar/index.cjs:58291:15)
at async Promise.all (index 0)
at async _LanguageServerSession.release (/tmp/.mount_enso-leMqqdS/resources/app.asar/index.cjs:59165:5)
at async /tmp/.mount_enso-leMqqdS/resources/app.asar/index.cjs:59670:7 {
cause: JSONRPCError2: Request timeout request took longer than 15000 ms to resolve
at new JSONRPCError2 (/tmp/.mount_enso-leMqqdS/resources/app.asar/index.cjs:26822:30)
at Timeout._onTimeout (/tmp/.mount_enso-leMqqdS/resources/app.asar/index.cjs:26985:20)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7) {
code: 7777,
data: undefined
},
request: 'text/closeFile',
params: {
path: {
rootId: '00000000-0000-0000-0000-000000000001',
segments: [Array]
}
}
}
```
2024-05-09 15:41:50 +00:00
Jaroslav Tulach
78eb7f3efc
Language server needs java.desktop and java.se modules (#9885)
Fixes regression introduced by #9868 - language server still needs dependency on `java.desktop` and `java.se`.
2024-05-08 07:53:19 +00:00
Jaroslav Tulach
ced7ba2de2
Syntax error shall contain location of the error (#9864)
Fixes #8735 by making sure compilation errors contain `SourceSection` identifying location where they occurred. This behavior is required by Truffle TCK. The TCK allocates its own `Context` without any other configuration and still requires a syntax error to be reported. Thus changing the default mode to _strict errors_.
2024-05-07 15:15:51 +00:00
Jaroslav Tulach
a69d89b274
Reduce set of JDK modules required by Enso (#9868) 2024-05-07 14:13:21 +02:00
Hubert Plociniczak
930f3c593e
Minor follow up to #9528 (#9841)
While playing with the implementation addressed some PR comments of mine and applied DRY.
2024-05-07 08:12:43 +00:00
Hubert Plociniczak
459a264ca2
Workaround slow responses with retries (#9858)
Follow up to #9558, this time to `SetExecutionContextEnvironmentHandler` that was timing out in #9789.
Added a base classes that handles the repeatable logic.

Maybe it will close #9789.
2024-05-06 19:37:01 +00:00
Jaroslav Tulach
6902f5e0b3
Pretending WithWarnings isException (#9840) 2024-05-06 03:40:44 +02:00