Skip to content

Fix type-mismatch confusion in types with simple name #19088

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

Conversation

ausmarton
Copy link
Contributor

An attempt to fix #18678

@nicolasstucki
Copy link
Contributor

There are two failing tests:

  • tests/neg/i9958.scala
  • tests/neg/i4986c.scala

Both fail because selectionString differentiated between scala.collection.immutable.List and its alias scala.List.

@nicolasstucki nicolasstucki self-assigned this Nov 27, 2023
@ausmarton
Copy link
Contributor Author

There's some further changes I might need to do to get it to compile, but thanks for the suggestion

@ausmarton ausmarton force-pushed the fix/i18678-type-mismatch-confusion-for-simple-types branch 7 times, most recently from 82ec1b5 to 7c0ff57 Compare November 30, 2023 15:28
@ausmarton
Copy link
Contributor Author

Took a bit longer than I thought it would and a few iterations, but the current version appears to be satisfying all the existing test expectations.

@@ -88,7 +88,7 @@ object Message:
def followAlias(e1: Recorded): Recorded = e1 match {
case e1: Symbol if e1.isAliasType =>
val underlying = e1.typeRef.underlyingClassRef(refinementOK = false).typeSymbol
if (underlying.name == e1.name) underlying else e1
if (underlying.name == e1.name) underlying else e1.namedType.dealias.typeSymbol
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nicolasstucki dealiasing within PlainPrinter didn't seem to make a difference, but this seems to do the trick.

@nicolasstucki
Copy link
Contributor

@ausmarton could you squash all commits into one?

@ausmarton ausmarton force-pushed the fix/i18678-type-mismatch-confusion-for-simple-types branch 6 times, most recently from 9d7419d to 792293d Compare December 5, 2023 00:26
@ausmarton ausmarton closed this Dec 5, 2023
@ausmarton ausmarton force-pushed the fix/i18678-type-mismatch-confusion-for-simple-types branch from 792293d to 7480582 Compare December 5, 2023 16:22
@ausmarton
Copy link
Contributor Author

Sorry, I accidentally closed this Pull request. Will create a new one, as I'm unable to reopen this one

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.

Confusion in type error when two types have same simple name
2 participants