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

Adding type annotations and enabling auto-scoping #10173

Merged
merged 22 commits into from
Jun 10, 2024
Merged

Conversation

jdunkerley
Copy link
Member

@jdunkerley jdunkerley commented Jun 4, 2024

Pull Request Description

  • 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

aggregate:
image

join:
image

set:
image

Important Notes

Checklist

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

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.

@jdunkerley jdunkerley added the CI: No changelog needed Do not require a changelog entry for this PR. label Jun 4, 2024
@jdunkerley jdunkerley force-pushed the wip/jd/autoscoping branch 3 times, most recently from 24ba0b9 to 90d67cc Compare June 6, 2024 11:17
@jdunkerley jdunkerley marked this pull request as ready for review June 6, 2024 14:49
@@ -22,25 +23,25 @@ polyglot java import org.enso.base.Regex_Utils

type Filter_Condition
## Is less than a value (or another column, in case of Table operations)?
Less than:Any action:Filter_Action=Filter_Action.Keep
Less than:Any=(Missing_Argument.throw "than") action:Filter_Action=Filter_Action.Keep
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use throw over ensure_present?

Copy link
Member Author

Choose a reason for hiding this comment

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

didn't want the stack location etc - just the bare minimum error for now.

Copy link
Member

Choose a reason for hiding this comment

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

The source location was not being displayed anyway.

IMHO ensure_present has the nice advantage that it shows which function this argument belongs to (unless that's broken?). Then it makes it easier to localize where the missing thing is in a big expression (e.g. a join with many parameters).

But OK to just keep simple for now if you think that's better, we can always change in the future.

@@ -21,6 +21,7 @@ type Case_Sensitivity

Arguments:
- locale: The locale used for the comparison.
@locale Locale.default_widget
Copy link
Member

Choose a reason for hiding this comment

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

Is this a defect somewhere else that you need to add this?

Comment on lines -304 to -311
predicate : Function -> handle_constructor_missing_arguments predicate predicate
predicate : Function -> predicate
element -> (== element)

## PRIVATE
Checks if the given `function` is actually a `Filter_Condition` constructor
that is just missing arguments. If so, it will report a more friendly error.
Otherwise it will run the `continuation`.
handle_constructor_missing_arguments function ~continuation =
Copy link
Member

Choose a reason for hiding this comment

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

Good that we no longer need this :)

Copy link
Member

@radeusgd radeusgd left a comment

Choose a reason for hiding this comment

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

Looks great, just a few small comments.

The Missing_Argument trick is really really awesome, it finally makes it so that we don't get some weird internal errors for 'half done' nodes but instead we get a clear message about a missing argument. This is really a great pattern that I hope we will use.

@@ -22,25 +24,25 @@ polyglot java import org.enso.base.Regex_Utils

type Filter_Condition
## Is less than a value (or another column, in case of Table operations)?
Less than:Any action:Filter_Action=Filter_Action.Keep
Less than=(Missing_Argument.throw "than") action:Filter_Action=Filter_Action.Keep
Copy link
Member

@JaroslavTulach JaroslavTulach Jun 8, 2024

Choose a reason for hiding this comment

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

_ -> ". Try to apply " + (missing_args.join ", ") + " arguments"

feel free to reformulate the sentece anyway you want.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will try this in the next PR and if it works switch to then.

Copy link
Member

@JaroslavTulach JaroslavTulach Jul 9, 2024

Choose a reason for hiding this comment

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

Hello @jdunkerley, does the

approach work for you? Can it be used instead of `Missing_Argument.throw "than", please? CCing @GregoryTravis

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is the best solution now because it requires no changes to Numbers.enso type signatures. It adds a special case to the error class but that seems acceptable.


## PRIVATE
Resolves a possibly auto-scoped value to a concrete value.
resolve_auto_scoped : Any -> Any
Copy link
Member

Choose a reason for hiding this comment

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

Please use private keyword.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can't in this case as used across different libraries but yes will do.

@jdunkerley jdunkerley force-pushed the wip/jd/autoscoping branch from 1e14a09 to df74d11 Compare June 9, 2024 16:19
@4e6 4e6 requested a review from JaroslavTulach June 9, 2024 17:04
@jdunkerley jdunkerley added the CI: Ready to merge This PR is eligible for automatic merge label Jun 10, 2024
@mergify mergify bot merged commit d938c96 into develop Jun 10, 2024
37 checks passed
@mergify mergify bot deleted the wip/jd/autoscoping branch June 10, 2024 07:52
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.

6 participants