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

A ClassTypeParamSymbol can have a UniqueTypeName #415

Closed
adpi2 opened this issue Dec 4, 2023 · 0 comments
Closed

A ClassTypeParamSymbol can have a UniqueTypeName #415

adpi2 opened this issue Dec 4, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@adpi2
Copy link
Member

adpi2 commented Dec 4, 2023

In "org.typelevel" %% "cats-core" % "2.6.1" there is this:

  // the Dummy type is to make this one more specific than catsDataMonadErrorMonadForOptionT on 2.13.x
  // see https://github.com/typelevel/cats/pull/2335#issuecomment-408249775
  implicit def catsDataMonadErrorForOptionT[F[_], E](implicit
    F0: MonadError[F, E]
  ): MonadError[OptionT[F, *], E] { type Dummy } =
    new OptionTMonadError[F, E] {
      type Dummy
      implicit val F = F0
    }

which produces a ClassTypeParamSymbol with name _$79.

TASTy Query expects that only LocalTypeParamSymbol can have a unique name and so it throws a UnsupportedOperationException:

java.lang.UnsupportedOperationException: _$79 -- /T[unique _$ 79]
	at tastyquery.Symbols$TypeSymbol.<init>(Symbols.scala:709)
	at tastyquery.Symbols$TypeSymbolWithBounds.<init>(Symbols.scala:732)
	at tastyquery.Symbols$TypeParamSymbol.<init>(Symbols.scala:778)
	at tastyquery.Symbols$ClassTypeParamSymbol.<init>(Symbols.scala:800)
	at tastyquery.Symbols$ClassTypeParamSymbol$.create(Symbols.scala:855)
	at tastyquery.reader.tasties.TreeUnpickler.createSymbols(TreeUnpickler.scala:113)

The bug is here:

if name.toTermName.isInstanceOf[UniqueName] && !this.isInstanceOf[LocalTypeParamSymbol] then
throw UnsupportedOperationException(s"${this.displayFullName: @unchecked} -- ${name.toDebugString}")

@sjrd sjrd self-assigned this Dec 5, 2023
@sjrd sjrd added the bug Something isn't working label Dec 5, 2023
@sjrd sjrd closed this as completed in d16ccdd Dec 6, 2023
sjrd added a commit that referenced this issue Dec 6, 2023
Fix #415: Allow `ClassTypeParamSymbol`s to have a `UniqueName`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants