Skip to content

Conversation

@tanishiking
Copy link
Member

It seems like TopLevelCantBeImplicit is no longer the case as of #5754
And it is actually confirmed in https://github.com/lampepfl/dotty/blob/93fc41fcb624df73cc12d52b79d518a30a778a7c/tests/run/toplevel-implicits/a.b.scala#L19-L21

This commit removes the unnecessary check in from Checking.scala
and deleted the ErrorMessage definition for TopLevelCantBeImplicit.

Or should we leave the check just in case the compiler got a bug for some reason and we encounter the case?

@bishabosha
Copy link
Member

I believe that this check runs after desugaring + typing, by which point the "top-level" implicit definition is wrapped in an object, so then its owner would be the wrapper object, not a package. I think this is useful as a regression test still.

@tanishiking
Copy link
Member Author

Thank you for the input! Yeah, I think that's why there shouldn't be a case where reach the path.

I think this is useful as a regression test still.

For regression test purpose, can we make it assertion instead of emitting compile error?

@bishabosha
Copy link
Member

For regression test purpose, can we make it assertion instead of emitting compile error?

I think that would be a good option, this PR needs rebasing anyway to try and fix the CI

It seems like TopLevelCantBeImplicit is no longer the case as of scala#5754 And it is actually confirmed in https://github.com/lampepfl/dotty/blob/93fc41fcb624df73cc12d52b79d518a30a778a7c/tests/run/toplevel-implicits/a.b.scala#L19-L21 This commit replace the unnecessary check in from Checking.scala to assertion and deleted the `ErrorMessage` definition for `TopLevelCantBeImplicit`. I'm leaving the `TopLevelCantBeImplicitID` in `ErrorMessageID.scala` so we don't screw up the error number.
@tanishiking tanishiking force-pushed the toplevel-can-be-implicit branch from 2042a08 to 6442498 Compare April 22, 2022 06:53
@tanishiking
Copy link
Member Author

rebased and replace it with assert :)

@bishabosha bishabosha enabled auto-merge April 22, 2022 08:00
@bishabosha bishabosha merged commit 7ee8986 into scala:main Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants