Skip to content

Fix examples of opaque types #7259

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

Merged
merged 1 commit into from
Dec 12, 2019
Merged

Conversation

panacekcz
Copy link
Contributor

The bug in Logarithm was reported by @wks on gitter.

Perhaps in both cases, it is not obvious that the operator on the right hand side is the one from the underlying type.
Especially in the second case, where ReadWrite must be defined as ReadOnly | WriteOnly inside Access, but the equivalent defined outside Access would be ReadOnly & WriteOnly.

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

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

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Have an awesome day! ☀️

@panacekcz
Copy link
Contributor Author

panacekcz commented Nov 11, 2019

Explanation:

  1. the * in LogarithmOps adds two logarithms to compute multiplication of two numbers. The result of such addition is a logarithm of the product, so it should be converted from Double to Logarithm directly, without applying math.log to it.
  2. The ReadWrite value in Access must use the | operator on the underlying integers of Read and Write to compute a value with both bits set. Using & on the underlying integers would make the value 0, which would be the same as NoPermission.
    Similarly, the & operator must use | operator on the underlying integers.

The continuous-integration failure does not seem to be related to this fix.

@panacekcz panacekcz removed their assignment Nov 11, 2019
@odersky
Copy link
Contributor

odersky commented Dec 12, 2019

This somehow fell through the review cracks. Anyway, looks all good. Thank you for the fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants