Commit Graph

2337 Commits

Author SHA1 Message Date
Marcin Kostrzewa
901760816c
State rework & IO Contexts (#3828)
1. Changes how we do monadic state – rather than a haskelly solution, we now have an implicit env with mutable data inside. It's better for the JVM. It also opens the possibility to have state ratained on exceptions (previously not possible) – both can now be implemented.
2. Introduces permission check system for IO actions.
2022-10-26 16:22:08 +00:00
Radosław Waśko
bb29833da5
Create a Table Row Type and expose as a Vector on In-Memory Table with .rows property (#3827)
Implements https://www.pivotaltracker.com/story/show/182307026
2022-10-26 11:21:33 +00:00
Dmitry Bushev
46441ca7a8
Add isStatic method field (#3829)
PR adds `isStatic` field to suggestion. The field is required for Component Browser.
2022-10-26 09:12:45 +00:00
Hubert Plociniczak
55b9bea352
Initialize Builtins at Native Image build time (#3821)
Moved loading of Builtin Types and Methods to a static initializer. That way the information is available at Native Image build time and one does not have to update a corresponding entry in `reflect-config` which would be a real pain when we start using it in anger.
Fixes https://www.pivotaltracker.com/story/show/183374932
2022-10-25 18:28:10 +00:00
Adam Obuchowicz
639f612adf
Update shortcuts to reflect Component Browser design docs. (#3823)
When no node is edited, `Enter` creates a new one (opening Component Browser). The shortcut for entering node was changed to `cmd + Enter`
2022-10-25 17:21:12 +00:00
Ilya Bogdanov
c2b82b9934
Editing via esc does not correctly update node view (#3799)
Fixes https://www.pivotaltracker.com/story/show/182926584
[Task link](https://www.pivotaltracker.com/story/show/183426449)

This PR fixes an IDE freeze introduced by https://github.com/enso-org/enso/pull/3732 and reimplements reverting edited nodes to their previous state.

The cause of the IDE freeze is quite interesting. A detailed investigation is available [here](https://gist.github.com/vitvakatu/785e34881368b8cfda61715d7543cbd0).

The graph editor needs to update the Presenter state only if the user is editing the node. Before this PR, the graph editor notified the Presenter with a visual representation of the node content instead of code expression. It caused inconsistency between the states of the controller and Presenter and caused severe performance issues.

https://user-images.githubusercontent.com/6566674/195831224-6d6e8258-e347-48b4-890a-d89c7300bc39.mp4

# Important Notes
- ~~There is a more complex alternative solution – it requires refactoring of the `component::node::input::area` module. The Presenter can be notified with `expression.code` changes, not `expression.viz_code`. I found a simpler solution (`.gate(&edit_mode)`), which has the same effect but does not require additional refactoring.~~ Said solution is implemented in a separate commit
2022-10-25 15:37:49 +00:00
Hubert Plociniczak
f6379fb1f7
Accept Array-like objects seamlessly in builtins (#3817)
Most of the time, rather than defining the type of the parameter of the builtin, we want to accept every Array-like object i.e. Vector, Array, polyglot Array etc.
Rather than writing all possible combinations, and likely causing bugs on the way anyway as we already saw, one should use `CoerceArrayNode` to convert to Java's `Object[]`.
Added various test cases to illustrate the problem.
2022-10-25 12:44:48 +00:00
Radosław Waśko
bc09c7b4c2
Remove obsolete Rust parser experiment, superseded by the much more mature new Rust parser integration (#3815)
We've had an old attempt at integrating a Rust parser with our Scala/Java projects. It seems to have been abandoned and is not used anywhere - it is also superseded by the new integration of the Rust parser. I think it was used as an experiment to see how to approach such an integration.

Since it is not used anymore - it make sense to remove it, because it only adds some (slight, but non-zero) maintenance effort. We can always bring it back from git history if necessary.
2022-10-24 14:56:07 +00:00
Radosław Waśko
2bc0611869
Add support for using Columns within Is_In (#3822)
Implements https://www.pivotaltracker.com/story/show/183560222
2022-10-24 12:51:15 +00:00
James Dunkerley
f0f6deef2a
Load the File_Format types via a ServiceLoader (#3813)
Moves the File.read method into the `File` type.
Uses the ServiceLoader to find all types for the File_Format.
2022-10-24 09:55:18 +00:00
Jaroslav Tulach
d8882f606d
Few more properly parsed files (#3826)
Another part of #3611 with few more `TreeToIr` improvements.

# Important Notes
Unofficial `LoadParser.sh` check from #3611 of all library files now reports just 54 failures out of 222 files - e.g. 75% success rate.
2022-10-24 08:53:37 +00:00
Radosław Waśko
c1c9be2998
Update CODEOWNERS to avoid project files being owned by just one person (#3820)
Only exception: CI files, as no-one apart from @mwu-tow is currently modifying them anyway
2022-10-22 05:45:55 +00:00
Jaroslav Tulach
42d0e40db7
Order of types in method signatures and more robust comment handling (#3825)
Another part of #3611 to integrate into `develop` branch.
2022-10-22 04:19:13 +00:00
Jaroslav Tulach
7bcd76ac5c
Test to make sure number of files accepted by the new parser only grows (#3814)
A new test to verify that some `Standard.Base` library files can be parsed by the new parser is added. Use it as:
```bash
$ sbt bootstrap
$ sbt buildEngineDistribution
$ sbt "runtime/testOnly *ParseStdLibTest"
```
By having this test instantly available we can block integration of PRs that would decrease the number of parseable files or introduce new files that aren't paseable.

# Important Notes
The test contains a _black list_ of classes that are currently known to fail. Over the time the _black list_ shall get smaller and smaller.
2022-10-21 15:09:32 +00:00
Hubert Plociniczak
6c440beecc
Move logic calculating the index in Vector.at to a builtin method to make the performance of Vector to be on par with Array (#3811)
The main culprit of a Vector slowdown (when compared to Array) was the normalization of the index when accessing the elements. Turns out that the Graal was very persistent on **not** inlining that particular fragment and that was degrading the results in benchmarks.

Being unable to force it to do it (looks like a combination of thunk execution and another layer of indirection) we resorted to just moving the normalization to the builtin method. That makes Array and Vector perform roughly the same.

Moved all handling of invalid index into the builtin as well, simplifying the Enso implementation. This also meant that `Vector.unsafe_at` is now obsolete.
Additionally, added support for negative indices in Array, to behave in the same way as for Vector.

# Important Notes
Note that this workaround only addresses this particular perf issue. I'm pretty sure we will have more of such scenarios.
Before the change `averageOverVector` benchmark averaged around `0.033 ms/op` now it does consistently `0.016 ms/op`, similarly to `averageOverArray`.
2022-10-20 12:50:44 +00:00
Radosław Waśko
cc76e7d36a
Add support for Blank_Columns to Table and Database (#3812)
Implements https://www.pivotaltracker.com/story/show/183390281 and https://www.pivotaltracker.com/story/show/183390394
2022-10-20 09:11:08 +00:00
Mateusz Czapliński
81e5e77ae8
A caption when hovering the marketplace button on the left bar of Component Browser (#3783)
When hovering the mouse pointer over the Marketplace button on the left bar of the Component Browser, show a caption informing that the Marketplace will be available soon.

https://www.pivotaltracker.com/story/show/182613789

#### Visuals

The video below demonstrates the caption shown when hovering the Marketplace button on the left bar of the Component Browser. It shows the caption disappearing after a hardcoded time, or when the mouse pointer is moved away from the button.







https://user-images.githubusercontent.com/273837/196195809-45a712e1-ad86-47d8-99ff-1475a0b74c6e.mov

# Important Notes
- The "Label" visual component was fixed. Previously, the width calculation of the background was not synchronized correctly with the text width. As a result, a zero-width background was displayed when a Label was shown for the first time.
2022-10-19 16:07:40 +00:00
Adam Obuchowicz
c4e89a8afd
Fix potential dobule-borrow panic. (#3807)
There is one place in code, where we can potentially panic on double borrow, because the drop routine is done while having data borrowed.

# Important Notes
The issue was easily reproducible on @Frizi machine.
2022-10-19 12:11:38 +00:00
Jaroslav Tulach
21fe0b8865
Process documentation in type definitions (#3806)
Another part of #3611 ready for integration into `develop` branch.

# Important Notes
Test `org.enso.compiler.EnsoCompilerTest.testTestGroup` is ignored as it has problems with source offsets - identifiers don't have the appropriate names due to `Tree.codeRepr()` being _off_.
2022-10-19 09:19:42 +00:00
Kaz Wesley
feb8eb4f83
fix span bug in doc comments (#3808) 2022-10-18 20:37:36 +00:00
Radosław Waśko
17f73988e8
Update drop_missing_rows to filter_blank_rows API. (#3805)
Implements https://www.pivotaltracker.com/story/show/183390042 and https://www.pivotaltracker.com/story/show/183390370
2022-10-18 15:58:50 +00:00
Pavel Marek
a53fbc79be
Improve Unsupported_Argument_Types message. (#3803)
Improve `Unsupported_Argument_Types` error so that it includes the message from the original exception. `arguments` field is retained, but not included in `to_display_text` method.
2022-10-18 12:03:25 +00:00
Kaz Wesley
28daf14f75
Parse case-by-type, add an old-lambda syntax rule (#3802)
- Special precedence rules for case-of so that `:` operator works without parens or nospace-grouping.
- Support an old-lambda syntax: `x->x-> x`. According to the usual rules, the first nospace group would be parsed as an operator section. The expression now parses as a lambda that contains a lambda.
- Match old parser treatment of # in doc comments.
- Tweak precedence so (a : B = c) works.
- Documented constructors.
2022-10-17 22:46:52 +00:00
Ilya Bogdanov
78b8f43b96
Show section name in breadcrumbs (#3778)
This PR implements displaying a currently active section name as a first crumb in the breadcrumbs panel. Sections are called `Popular`, `Modules` and `Local`.


https://user-images.githubusercontent.com/6566674/194551276-90bd7d6b-8509-43ec-b3c0-11c35fda9063.mp4

# Important Notes
This PR also contains a fix for [this bug](https://www.pivotaltracker.com/story/show/183499312). It was caused by mistake in the FRP implementation of the breadcrumbs. You could only trigger this bug after code changes in the `animation/loop.rs` module. It is not possible to see it otherwise. Still, the code was not correct, and now it is fixed.
2022-10-17 13:26:40 +00:00
James Dunkerley
701c644d0e
Tidy up the remaining ones except Base... (#3797)
- Removed `Dubious constructor export` from Examples, Geo, Google_Api, Image and Test.
- Updated Google_Api project to meet newer code standards.
- Restructured `Standard.Test`:
- `Main.enso` now exports `Bench`, `Faker`, `Problems`, `Test`, `Test_Suite`
- `Test.Suite` methods moved into a `Test_Suite` type.
- Moved `Bench.measure` into `Bench` type.
- Separated the reporting to a `Test_Reporter` module.
- Moved `Faker` methods into `Faker` type.
- Removed `Verbs` and `.should` method.
- Added `should_start_with` and `should_contain` extensions to `Any`.
- Restructured `Standard.Image`:
- Merged Codecs methods into `Image`.
- Export `Image`, `Read_Flag`, `Write_Flag` and `Matrix` as types from `Main.enso`.
- Merged the internal methods into `Matrix` and `Image`.
- Fixed `Day_Of_Week` to be exported as a type and sort the `from` method.
2022-10-17 11:27:27 +00:00
Pavel Marek
47148a2ff1
Missing foreign language generates proper Enso error. (#3798)
Trying to invoke a foreign method with non-installed language (either not enabled in the Truffle `Context`, or not installed in the GraalVM distribution) results in `Polyglot_Error`, rather than crashing the entire engine.
2022-10-17 09:59:31 +00:00
Radosław Waśko
82de8f88bd
Add support for Is_In and Not_In to Filter_Condition (#3790)
Implements https://www.pivotaltracker.com/story/show/183389945
2022-10-15 11:29:59 +00:00
Hubert Plociniczak
811d82c787
Ensure all new parser files are checked for changes (#3800) 2022-10-15 07:06:20 +00:00
Kaz Wesley
2740406f93
Lex doc comments and attach text to AST (#3795)
- New `Documented` node attaches documentation, lexed as a raw text literal, to a statement.
- Handle a case of lambdas with body blocks.
2022-10-15 06:13:32 +00:00
Pavel Marek
e9260227c4
Duration type is a builtin type (#3759)
- Reimplement the `Duration` type to a built-in type.
- `Duration` is an interop type.
- Allow Enso method dispatch on `Duration` interop coming from different languages.

# Important Notes
- The older `Duration` type should now be split into new `Duration` builtin type and a `Period` type.
- This PR does not implement `Period` type, so all the `Period`-related functionality is currently not working, e.g., `Date - Period`.
- This PR removes `Integer.milliseconds`, `Integer.seconds`, ..., `Integer.years` extension methods.
2022-10-14 18:08:08 +00:00
Paweł Grabarz
ce6267f098
Add replace_text method to In-Memory Table (#3793)
Implements https://www.pivotaltracker.com/n/projects/2539304/stories/183415329
2022-10-14 17:42:29 +02:00
Jaroslav Tulach
5873af88c5
More coding patterns converted to IR (#3796)
Few more coding patterns found in stdlib converted from `Tree` to `IR`.
2022-10-14 14:14:54 +00:00
Hubert Plociniczak
14ed2812ee
Don't crash interpreter on missing method (#3787)
When trying to resolve an invalid method of a polyglot array we were reaching a state where no specialization applied.
Turns out we can now simplify the logic of inferring polyglot call type for arrays and avoid the crash.
2022-10-14 13:17:13 +02:00
Adam Obuchowicz
148d32e4c3
Component Browser with Grid View (#3766)
This PR introduced an overhauled Component List Panel implementation, making use of the efficient EnsoGL grid view component. Also, it delivers a couple of new features:
* A part of the new design: there are no more section headers in grid, instead groups are "glued" together. The local scope section is under "popular" (old "favorites").
* The keyboard management inside grid works.
* there is a mouse hover highlight
* selecting the lowest entry in section when jumping with navigation bar.
* accepting input as-is with cmd/ctrl + Enter.

https://user-images.githubusercontent.com/3919101/194561890-fffb9b41-2f0d-4357-8d9a-5038a6bcb023.mp4


### Important Notes

**What is not implemented:**
* [Focus management between panels.](https://www.pivotaltracker.com/story/show/180872763) The grid is always focused. To accept the current input, use ctrl+Enter shortcut.
* [Proper handling of selection when having empty space on the right and pressing right arrow.](https://www.pivotaltracker.com/story/show/183487880)
* When entering a module, its name is not added to the input as described in the design doc. Will be a part of [this User Story](https://www.pivotaltracker.com/story/show/181058321).

**Known issues**
* [the selection, especially in the local scope section, has sometimes an undesirable offset](https://www.pivotaltracker.com/story/show/183487730). The cause is known, but not so easy to fix.
* The inserted nodes are often producing errors. The Browser's inherits the outdated understanding of the language from old Node Searcher, and it does not include new form of imports, static methods etc. Those all will be fixed as a part of [this User Story](https://www.pivotaltracker.com/story/show/181058321).
* The performance is improved, but still not ideal, due to problems in [text areas](https://www.pivotaltracker.com/story/show/183406745).
* To scroll the documentation panel, you must first click on it.
2022-10-14 12:42:59 +02:00
Kaz Wesley
0e412044f6
Macro contexts (#3792)
- Implement macro-contexts-lite (`from` is now only a keyword at the beginning of a line)
- Support special nospace-group handling for old lambdas (so expressions like this work: `x-> y-> x + y`)
- Fix a text-escape incompatibility

# Important Notes
- There is now an `OperatorFunction`, which is like a `Function` but has an operator for a name, and likewise an `OperatorTypeSignature`.
2022-10-13 22:47:02 +00:00
Michał Wawrzyniec Urbańczyk
e188b15973
Fetch the remote branch before comparing. (#3794) 2022-10-13 19:41:20 +02:00
Kaz Wesley
5668cbcc24
Qualified defs (#3785)
Allow qualified names in LHS of type signatures and method definitions.
2022-10-12 17:40:16 +00:00
Jaroslav Tulach
102dd9a790
Supporting self attribute, type methods and operations (#3789)
Supporting self attribute, type methods and operations in the Rust parser to `IR` conversion. Another part extracted out of #3611.
2022-10-12 09:50:32 +00:00
Adam Obuchowicz
6c3a95296b
Sign MacOS package on CI only (#3788) 2022-10-12 00:32:08 +02:00
Radosław Waśko
592a8516a8
Add Is_Empty, Not_Empty, Like and Not_Like to Filter_Condition (#3775)
Implements https://www.pivotaltracker.com/story/show/183389890
2022-10-10 23:11:04 +00:00
Michał W. Urbańczyk
af3ebccb39 Updated the required changelog check. Removed dead config for release branches. 2022-10-10 23:43:46 +02:00
Michał Wawrzyniec Urbańczyk
ad69eeb4ad
Build script merge (#3743)
Merged the build script into main repository. Some related cleanups.
2022-10-10 23:38:48 +02:00
Jaroslav Tulach
5386a8be07
Convert annotations provided by the new parser to IR (#3784)
Builds on top of #3780 and converts the new `Tree.Annotated` to IR.
[ci no changelog needed]
2022-10-10 20:37:39 +00:00
Marcin Kostrzewa
b3dd778eed
Static, but instance, but static (#3764)
Adds the ability to write `Foo.method (Mk_Foo 123)` as a synonym of `(Mk_Foo 123).method` because Rust.
2022-10-10 19:28:33 +00:00
Hubert Plociniczak
7e0ab8908c
Fix for perf degradation in method calls on polyglot arrays (#3781) 2022-10-10 16:35:38 +00:00
Adam Obuchowicz
4152962161
Fix text sync with Engine (#3779)
There was a regression introduced by PR #3678 with text synchronization between IDE and the Engine. This PR fixes it.

It was reproducible as an error log about version mismatch in a case when the metadata becomes shorter (e.g. on removing node).

# Important Notes
[ci no changelog needed]
2022-10-10 12:41:08 +00:00
Kaz Wesley
2fab9ee1e9
Implement annotations (#3780)
- `->` lambda operator isn't bound by nospace groups; see new test case.
- Implemented annotations.
2022-10-10 07:09:01 +00:00
Jaroslav Tulach
ea60cd5fab
Supporting more of the Enso language syntax in the newly built IR (#3777)
Supporting more of the Enso language syntax in the IR built by the new Rust parser.
2022-10-07 13:32:44 +00:00
James Dunkerley
9301f2dcc5
Sort out statics in Database. (#3774)
- Moved `Standard.Database.connect` into `Standard.Database.Database.connect`, so can now just `from Standard.Database import ...`.
- Removed all `Dubious constructor export`s.
- Switched to using `project` for internal imports.
- Moved to using `Value` for private constructors and not re-exporting.
- Export types not modules from `Standard.Database`.
- Broke up `IR` into separate files (Context, Expression, From_Spec, Internal_Column, Join_Kind, Query).
- No longer use `IR.` instead via specific types.
- Broke up `SQL` into separate files (SQL_Type and SQL_Statement).

Additionally;
- Standard.Table: Moved `storage_types` into `Storage`.
- Standard.Table: Switched to using `project` for internal imports.
- Standard.Table.Excel: Renamed modules `Range` to `Excel_Range` and `Section` to `Excel_Section`.
- `Standard.Visualisation`: Switched to using `project` for internal imports.
- `Standard.Visualisation`: Moved to using `Value` for private constructors and not re-exporting.

# Important Notes
- Have not cleared up the `Errors` yet.
- Have not switched to type pattern matching.
2022-10-07 11:32:00 +00:00
Hubert Plociniczak
841b2e6e7a
Suppress some obvious warnings (#3768) 2022-10-07 10:07:40 +00:00