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

Out of memory on opaque type usage in enclosed class #16740

Closed
Adam-Vandervorst opened this issue Jan 22, 2023 · 0 comments · Fixed by #16754
Closed

Out of memory on opaque type usage in enclosed class #16740

Adam-Vandervorst opened this issue Jan 22, 2023 · 0 comments · Fixed by #16754

Comments

@Adam-Vandervorst
Copy link

Compiler version

3.2.1

Minimized code

class Enclosing:
  object Tags:
    opaque type Ref[T, S <: String & Singleton] = S
    inline def require[T, S <: String & Singleton]: Ref[T, S] = ???
  import Tags.*

  val t1 = require[Int, "t1"]
  val t2 = require[Double, "t2"]

Output (click arrow to expand)

java.lang.OutOfMemoryError: Java heap space
	at dotty.tools.dotc.ast.untpd$.TypeApply(untpd.scala:378)
	at dotty.tools.dotc.ast.tpd$.TypeApply(tpd.scala:55)
	at dotty.tools.dotc.ast.tpd$TreeOps$.appliedToTypeTrees$extension(tpd.scala:969)
	at dotty.tools.dotc.ast.tpd$TreeOps$.appliedToTypes$extension(tpd.scala:961)
	at dotty.tools.dotc.ast.tpd$TreeOps$.appliedToType$extension(tpd.scala:957)
	at dotty.tools.dotc.ast.tpd$TreeOps$.asInstance$extension(tpd.scala:998)
	at dotty.tools.dotc.transform.Erasure$Boxing$.cast(Erasure.scala:371)
	at dotty.tools.dotc.transform.Erasure$Typer.recur$1(Erasure.scala:785)
	at dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:789)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2889)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2982)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3050)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3054)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3170)
	at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:2295)
	at dotty.tools.dotc.transform.Erasure$Typer.typedValDef(Erasure.scala:897)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2893)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2982)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3050)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3054)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3076)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3126)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:1043)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1060)
	at dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1916)
	at dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:888)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2942)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2983)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3050)
[error] [launcher] error during sbt launcher: java.lang.OutOfMemoryError: Java heap space
@Adam-Vandervorst Adam-Vandervorst added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 22, 2023
@Adam-Vandervorst Adam-Vandervorst changed the title Out of memory on opaque type usage in enclosed clsas Out of memory on opaque type usage in enclosed class Jan 22, 2023
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 23, 2023
In TreeTypeMap, don't generate a Select node if the new type of
the tree is a TermRef with NoPrefix. Generate an Ident node instead.

Fixes scala#16740
@odersky odersky added area:inline and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 23, 2023
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 23, 2023
In TreeTypeMap, don't generate a Select node if the new type of
the tree is a TermRef with NoPrefix. Generate an Ident node instead.

Fixes scala#16740
odersky added a commit that referenced this issue Jan 24, 2023
In TreeTypeMap, don't generate a Select node if the new type of the tree
is a TermRef with NoPrefix. Generate an Ident node instead.

Fixes #16740
@Kordyjan Kordyjan added this to the 3.3.1 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants