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

Allow ..Nothing to resolve to Nothing #9746

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Apr 19, 2024

Pull Request Description

Fixes #9738 in a different way than #9743.

Checklist

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

  • All code follows the
    Java,
  • All code has been tested:
    • Unit tests have been written where possible.

@JaroslavTulach JaroslavTulach added the CI: No changelog needed Do not require a changelog entry for this PR. label Apr 19, 2024
@JaroslavTulach JaroslavTulach self-assigned this Apr 19, 2024
@JaroslavTulach
Copy link
Member Author

Benchmarks run scheduled.

Comment on lines +510 to +513
group_builder.specify "Autoscope Nothing" <|
accept (n:Nothing) = n

accept ..Nothing . is_nothing . should_be_true
Copy link
Member

Choose a reason for hiding this comment

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

Looks ok but I think I missed why we want to allow that?

Copy link
Member Author

@JaroslavTulach JaroslavTulach Apr 19, 2024

Choose a reason for hiding this comment

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

Addresses #9738. The

introduced the ..Constructor syntax. In case of singletons like Nothing or Pavel (in the example below), the type is de-factor its own constructor. Thus it make sense to support ..Nothing or ..Pavel syntax of autoscoped constructors.

Copy link
Member

@Akirathan Akirathan left a comment

Choose a reason for hiding this comment

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

Is this supposed to work also for other types than Nothing? For example:

from Standard.Base import Date

main =
  ..Date == Date
```?

@JaroslavTulach
Copy link
Member Author

from Standard.Base import Date

main =
  ..Date == Date

This example yields False. Probably because == doesn't force conversion of unresolved constructor to real constructor. If I modify your code to:

from Standard.Base import Date

materialize (d:Date) = d

main =
  d = materialize ..Date
  d == Date

Then one gets Cannot find constructor ..Date among Date. It is all supposed to work only for singletons. Following program returns True:

type Pavel


materialize (d:Pavel) = d

main =
  d = materialize ..Pavel
  d == Pavel

@JaroslavTulach
Copy link
Member Author

Benchmarks seem to be unaffected by this change:

obrazek

@JaroslavTulach JaroslavTulach merged commit 11dda5b into develop Apr 22, 2024
39 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/AutoScopingForEigenTypes_9738 branch April 22, 2024 04:54
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should not use auto-scoping for atom types
6 participants