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

i16601 Fix class name in error message #16635

Merged
merged 5 commits into from
Jan 9, 2023
Merged

i16601 Fix class name in error message #16635

merged 5 commits into from
Jan 9, 2023

Conversation

nizhikov
Copy link
Contributor

@nizhikov nizhikov commented Jan 8, 2023

No description provided.

@nizhikov
Copy link
Contributor Author

nizhikov commented Jan 8, 2023

fixes #16601

@dwijnand dwijnand linked an issue Jan 8, 2023 that may be closed by this pull request
dwijnand
dwijnand previously approved these changes Jan 8, 2023
@dwijnand dwijnand dismissed their stale review January 8, 2023 22:15

Don't like the asInstanceOf

@nizhikov
Copy link
Contributor Author

nizhikov commented Jan 9, 2023

Hello @dwijnand - thanks for the review.
I replaced asInstanceOf with match.
Can you, please, advice me - what compiler suppose to do in case type not expected?
Right now I fallback to previous message.

        if (cls.isOneOf(AbstractOrTrait)) {
          srcTp.underlyingClassRef(refinementOK = false) match 
            case tref0: TypeRef => 
              val srcCls = tref0.symbol
              report.error(CantInstantiateAbstractClassOrTrait(srcCls, isTrait = srcCls.is(Trait)), pos)
            case _ => 
              report.error(CantInstantiateAbstractClassOrTrait(cls, isTrait = cls.is(Trait)), pos)
        }

@nizhikov
Copy link
Contributor Author

nizhikov commented Jan 9, 2023

@dwijnand Thanks for the review.

All checks passed. Anything else should be done prior merge?

@prolativ prolativ merged commit 7fe700b into scala:main Jan 9, 2023
@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
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.

Wrong error message when instantiating a trait from scala 2.13 stdlib
5 participants