Skip to content

endless compilation (more than 500 seconds) for simple program with -Xprint-types #9517

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

Closed
rssh opened this issue Aug 8, 2020 · 7 comments · Fixed by #9527
Closed

endless compilation (more than 500 seconds) for simple program with -Xprint-types #9517

rssh opened this issue Aug 8, 2020 · 7 comments · Fixed by #9527
Milestone

Comments

@rssh
Copy link
Contributor

rssh commented Aug 8, 2020

Minimized code

2 files:
X.scala:

package x

import scala.quoted._

trait CB[T]

trait M[F[_]]

object MCB extends M[CB]

given M[CB] = MCB

object Y {

 inline def foundMF1[F[_],A](inline x: A)(using M[F]) : Boolean = ${
   foundMFImpl1('x)
 }

 def foundMFImpl1[F[_]:Type,A:Type](f:Expr[A])(using qctx: QuoteContext):Expr[Boolean] = {
    Expr( Expr.summon[M[F]].isDefined )
 }

}

and Main.scala

package x

object Main {

 def main(args:Array[String]):Unit =
   println(Y.foundMF1[CB,Any]({ case 1 => 10 }))
 
}

Output

rssh@rssh4 endless-compile % sbt clean compile   
[info] welcome to sbt 1.3.13 (N/A Java 14.0.1)
[info] loading settings for project endless-compile-build from plugins.sbt ...
[info] loading project definition from /Users/rssh/tests/dotty/endless-compile/project
Fetching latest Dotty nightly version...
Latest Dotty nightly build version: 0.27.0-bin-20200807-dfcc0b1-NIGHTLY
[info] loading settings for project root from build.sbt ...
[info] set current project to test (in build file:/Users/rssh/tests/dotty/endless-compile/)
[info] Executing in batch mode. For better performance use sbt's shell
[success] Total time: 0 s, completed 8 Aug 2020, 11:32:08
[info] Compiling 2 Scala sources to /Users/rssh/tests/dotty/endless-compile/target/scala-0.27/classes ...






  | => root / Compile / compileIncremental 541s

Expectation

will compiles.

@rssh rssh added the itype:bug label Aug 8, 2020
@rssh rssh changed the title endless compilation (more than 500 seconds) for simple program where given object is in top-level scope [jdk-14? endless compilation (more than 500 seconds) for simple program where given object is in top-level scope Aug 8, 2020
@rssh
Copy link
Contributor Author

rssh commented Aug 8, 2020

Hmm, looks like this depends from compiler flags: -Xprint-types.

-Xprint-types: endless

without --- show error.

@rssh
Copy link
Contributor Author

rssh commented Aug 8, 2020

endless-compile.tar.gz

(full sbt project)

@rssh rssh changed the title endless compilation (more than 500 seconds) for simple program where given object is in top-level scope endless compilation (more than 500 seconds) for simple program with -Xprint-types Aug 8, 2020
@rssh
Copy link
Contributor Author

rssh commented Aug 8, 2020

Hmm, looks like without implicit search - the same,
Minimized variant:

package x

import scala.quoted._
object Y {

 inline def foundMF1[F[_],A](inline x: A): Boolean = ${
   foundMFImpl1('x)
 }

 def foundMFImpl1[F[_]:Type,A:Type](f:Expr[A])(using qctx: QuoteContext):Expr[Boolean] = {
    Expr( true )
 }

}

and main the same:

package x


object Main {

 def main(args:Array[String]):Unit =
   println(Y.foundMF1[CB,Any]({ case 1 => 10 }))

}

@nicolasstucki
Copy link
Contributor

Minimized to a single file

package x

trait CB[T]

trait M[F[_]]

object MCB extends M[CB]

given M[CB] = MCB

object Y {
 def foundMF1[F[_],A](x: A)(using M[F]) : Boolean = true
}

object Main {

 def main(args:Array[String]):Unit =
   println(Y.foundMF1[CB,Any]({ case 1 => 10 }))

}

@smarter
Copy link
Member

smarter commented Aug 10, 2020

Really not sure, but might be related to #9504
EDIT: looks like it isn't

@nicolasstucki
Copy link
Contributor

Minimal

def test():Unit = foo({ case 1 => 10 })
def foo(x: Any): Boolean = true

@nicolasstucki
Copy link
Contributor

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Aug 10, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Aug 11, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Aug 11, 2020
nicolasstucki added a commit that referenced this issue Aug 31, 2020
Fix #9517: Do not print contents of ErrorType on -Xprint-types
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 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.

4 participants