Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use autoscoping when constructing tag values of suggestion arguments #9293

Merged

Conversation

4e6
Copy link
Contributor

@4e6 4e6 commented Mar 5, 2024

Pull Request Description

close #9259

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@4e6 4e6 added the CI: No changelog needed Do not require a changelog entry for this PR. label Mar 5, 2024
@4e6 4e6 self-assigned this Mar 5, 2024
@4e6 4e6 marked this pull request as ready for review March 6, 2024 15:43
@4e6 4e6 added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Mar 8, 2024
@4e6
Copy link
Contributor Author

4e6 commented Apr 3, 2024

I had to update the Text.take widget to return autoscoped constructors

@range Text_Sub_Range.default_widget
Text.take : (Text_Sub_Range | Index_Sub_Range | Range | Integer) -> Text ! Index_Out_Of_Bounds
Text.take self range=(Index_Sub_Range.First 1) =
and it seems that the GUI is able to work with the new .. syntax after the #9452 is merged

autoscope_cons_demo.mp4

| B
| C
|
|foo (a : T | K) = a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test for T | Any->Any or T | Function. They may require a specific attention as described here.

@JaroslavTulach
Copy link
Member

I had to update the Text.take widget to return autoscoped constructors

How did you have to update the Text.take widget?

@4e6
Copy link
Contributor Author

4e6 commented Apr 4, 2024

Method Text.take uses Text_Sub_Range.default_widget for the range argument. I had to update it to use the .. syntax

--- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Index_Sub_Range.enso
+++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Index_Sub_Range.enso
@@ -80,12 +80,12 @@ type Index_Sub_Range
        `Range` too.
     default_options : Vector Option
     default_options =
-        o1 = Option "First" "(Index_Sub_Range.First 1)"
-        o2 = Option "Last" "(Index_Sub_Range.Last 1)"
-        o3 = Option "While" "(Index_Sub_Range.While (x-> False))"
-        o4 = Option "By_Index" "(Index_Sub_Range.By_Index [0])"
-        o5 = Option "Sample" "(Index_Sub_Range.Sample 10)"
-        o6 = Option "Every" "(Index_Sub_Range.Every 2)"
+        o1 = Option "First" "(..First 1)"
+        o2 = Option "Last" "(..Last 1)"
+        o3 = Option "While" "(..While (x-> False))"
+        o4 = Option "By_Index" "(..By_Index [0])"
+        o5 = Option "Sample" "(..Sample 10)"
+        o6 = Option "Every" "(..Every 2)"
         o7 = Option "Range" "(Range.new 0 100)"
         [o1, o2, o3, o4, o5, o6, o7]

And ascribe the argument of course

--- a/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Extensions.enso
+++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Extensions.enso
@@ -1008,7 +1008,7 @@ Text.repeat self count=1 =
          "Hello World!".take (Sample 3 seed=42) == "l d"
 @range Text_Sub_Range.default_widget
 Text.take : (Text_Sub_Range | Index_Sub_Range | Range | Integer) -> Text ! Index_Out_Of_Bounds
-Text.take self range=(Index_Sub_Range.First 1) =
+Text.take self range:(Text_Sub_Range | Index_Sub_Range | Range | Integer)=(Index_Sub_Range.First 1) =
     ranges = Codepoint_Ranges.resolve self range
     case ranges of
         Range.Between start end 1 ->

@4e6 4e6 added CI: Ready to merge This PR is eligible for automatic merge and removed CI: Clean build required CI runners will be cleaned before and after this PR is built. labels Apr 8, 2024
@4e6 4e6 merged commit 1c4a927 into develop Apr 8, 2024
39 of 43 checks passed
@4e6 4e6 deleted the wip/db/9259-use-autoscoping-when-constructing-tag-values branch April 8, 2024 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use autoscoping when constructing tag values of suggestion arguments
3 participants