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

Binary operator resolution based on that value #8779

Merged
merged 67 commits into from
Jan 27, 2024

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Jan 16, 2024

Pull Request Description

Fixes #8346 by making sure binary operations like +, -,/, *, % accept any type as second argument under the assumption that the left Number is convertible to the type of second that argument via a from conversion.

Checklist

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

@JaroslavTulach
Copy link
Member Author

We have three failing tests:

That outlines what kind of Nodes we have to enhance to allow implementation of BigDecimal as a regular type.

@JaroslavTulach
Copy link
Member Author

JaroslavTulach commented Jan 26, 2024

Need to solve f5 d failure. It is a recent regression. 0542f48 should do the trick.

@JaroslavTulach
Copy link
Member Author

234417a adds new paragraph to operators docs. The paragraph follows the section that states Enso only supports binary operators (enforced by #8789). The next sections talk about operator priorities - that's very likely untrue/outdated, but it is for another PR to fix that.

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, I have a few questions / suggestions.

docs/syntax/functions.md Show resolved Hide resolved
Comment on lines +543 to +548
val operators = ".!$%&*+-/<>?^~\\"
def isOperator(n: Name): Boolean = {
n.name
.chars()
.allMatch(operators.indexOf(_) >= 0)
}
Copy link
Member

Choose a reason for hiding this comment

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

Later I will need to be able to check isOperator also in the compiler at the type inference pass, so this should probably be somewhere reachable from both places.

But I'm happy to move it when the time comes, it seems OK to be here for now

Copy link
Member Author

@JaroslavTulach JaroslavTulach Jan 26, 2024

Choose a reason for hiding this comment

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

I wasn't sure what is a right place for such method. But yeah, right now I'd rather integrate then seek for the right method name.

Copy link
Member Author

@JaroslavTulach JaroslavTulach Apr 18, 2024

Choose a reason for hiding this comment

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

Another incarnation of this isOperator check is here CCing @kazcw and @4e6.

test/Base_Tests/src/Data/Numbers_Spec.enso Show resolved Hide resolved
@JaroslavTulach
Copy link
Member Author

Benchmarks ( benchmark results, 2nd run) seem to be fine in general. If there is a regression, let's solve it individually after integrating.

JaroslavTulach and others added 5 commits January 26, 2024 19:59
Co-authored-by: Radosław Waśko <radoslaw.wasko@enso.org>
Co-authored-by: Radosław Waśko <radoslaw.wasko@enso.org>
Co-authored-by: Radosław Waśko <radoslaw.wasko@enso.org>
@JaroslavTulach
Copy link
Member Author

JaroslavTulach commented Jan 27, 2024

Run #4 failed in LibrariesTest: https://github.com/enso-org/enso/actions/runs/7672566748/job/20924679342?pr=8779#step:10:15522 - e.g. #8806

GitHub
Hybrid visual and textual functional programming. Contribute to enso-org/enso development by creating an account on GitHub.

@JaroslavTulach
Copy link
Member Author

Run #5 failed on #8806

@JaroslavTulach
Copy link
Member Author

Finally!

@JaroslavTulach JaroslavTulach merged commit 9a37357 into develop Jan 27, 2024
25 of 27 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/BigDecimalAndCo_8346 branch January 27, 2024 07:38
@JaroslavTulach JaroslavTulach mentioned this pull request Apr 18, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide engine support for decimal & co. types
5 participants