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

improvement: Make sure 'isAccessibleFrom' always succeeds #5271

Merged
merged 1 commit into from May 29, 2023

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented May 25, 2023

Previously, everything would break is isAccessibleFrom threw an exception. Now, we default to false, which is the safer option.

Connected to #5268

Previously, everything would break is `isAccessibleFrom` threw an exception. Now, we default to false, which is the safer option.

Connected to scalameta#5268
Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

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

Looks good, however this does raise a question for me. Should something like this just exist in the compiler? For me looking at isAccessibleFrom it gives no indication that it can throw. I think in the past I remember someone saying that all the asserts needed to stay as is since they really do indicate bugs, but we've hit on this so much that it makes me wonder if some more "safer" methods like this should just live in the compiler for tools to use.

@tgodzik
Copy link
Contributor Author

tgodzik commented May 29, 2023

I think the compiler should never throw an assertion error, since those are really not useful at all. And they do happen quite often from what I see.

Maybe we should raise an issue upstream?

@tgodzik tgodzik merged commit 500785d into scalameta:main May 29, 2023
21 of 23 checks passed
@tgodzik tgodzik deleted the add-try branch May 29, 2023 08:43
@ckipp01
Copy link
Member

ckipp01 commented May 29, 2023

I think the compiler should never throw an assertion error, since those are really not useful at all. And they do happen quite often from what I see.

Maybe we should raise an issue upstream?

Yea, let me collect a few different PRs where we'e done this sort of thing just to show what we mean, and then I'll create an issue for it in Dotty.

@tgodzik
Copy link
Contributor Author

tgodzik commented May 29, 2023

Thanks!

@tgodzik tgodzik added the Scala 3 Generic ticket relating to Scala 3 label May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scala 3 Generic ticket relating to Scala 3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants