Skip to content

Assertion error in DottyBackendInterface: denot.name is not default getter #2797

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
olafurpg opened this issue Jun 23, 2017 · 3 comments
Closed

Comments

@olafurpg
Copy link
Contributor

After merging the fix for #2704, I'm hitting a new assertion error in the backend while trying to compile the scala/compiler-benchmark with Dotty.

To reproduce

cd dotty
git checkout 0109fef834b4f08ba4dbc0fd08fe6f05753cb9b1
export NIGHTLYBUILD=yes
sbt dotty-bootstrapped/publishLocal
cd target
git clone https://github.com/olafurpg/compiler-benchmark.git
cd compiler-benchmark
git checkout c30610306e9bc7b5ed0609f0f24ca1054a48d26f // branch dotty2
sbt ++0.2.0-bin-20170623-0109fef-NIGHTLY compilation/test
...
[error] Error while emitting ScalacBenchmark.scala
[error] assertion failed
java.lang.AssertionError: assertion failed
	at scala.Predef$.assert(Predef.scala:156)
	at dotty.tools.backend.jvm.DottyBackendInterface.emitArgument(DottyBackendInterface.scala:259)
	at dotty.tools.backend.jvm.DottyBackendInterface.emitAssocs$$anonfun$2(DottyBackendInterface.scala:315)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
	at dotty.tools.backend.jvm.DottyBackendInterface.emitAssocs(DottyBackendInterface.scala:315)
	at dotty.tools.backend.jvm.DottyBackendInterface.emitAnnotations$$anonfun$2(DottyBackendInterface.scala:308)

Compiling with -Ycheck:all gives a hint that an error occurred while typechecking this line here:
https://github.com/scala/compiler-benchmark/blob/d0f038e0a9f367e26dbe9825de9d00e9e699f592/compilation/src/main/scala/scala/tools/nsc/ScalacBenchmark.scala#L38

exception while typing java.nio.file.Files.walk(this.findSourceDir,
  [java.nio.file.FileVisitOption.FOLLOW_LINKS : java.nio.file.FileVisitOption]:
    Array[java.nio.file.FileVisitOption]
) of class class dotty.tools.dotc.ast.Trees$Apply # 11397
exception while typing java.nio.file.Files.walk(this.findSourceDir,
  [java.nio.file.FileVisitOption.FOLLOW_LINKS : java.nio.file.FileVisitOption]:
    Array[java.nio.file.FileVisitOption]
).collect of class class dotty.tools.dotc.ast.Trees$Select # 11399
exception while typing java.nio.file.Files.walk(this.findSourceDir,
  [java.nio.file.FileVisitOption.FOLLOW_LINKS : java.nio.file.FileVisitOption]:
    Array[java.nio.file.FileVisitOption]
).collect[java.util.List[java.nio.file.Path]^,
  java.util.stream.Collector[java.nio.file.Path, _,
    java.util.List[java.nio.file.Path]
  ]#A^
] of class class dotty.tools.dotc.ast.Trees$TypeApply # 11402

I unsuccessfully tried to minimize the error with

import java.nio.file._
import java.util.stream.Collectors
import scala.collection.JavaConverters._

object foo {
  Files.walk(Paths.get("."), FileVisitOption.FOLLOW_LINKS).collect(Collectors.toList[Path]).asScala
}

The failed assertion is here:
https://github.com/lampepfl/dotty/blob/7381e9d5106dec40cce70471c2c0c755b4bd374b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala#L259

This issue is a blocker for merging scala/compiler-benchmark#31

@odersky
Copy link
Contributor

odersky commented Jun 23, 2017

In what phase did -Ycheck fail?

And, can you change the line that caused the assertion error to:

 assert(toDenot(t.symbol).name.is(DefaultGetterName), toDenot(t.symbol).name.debugString) // this should be default getter. 

It would be good to see what name it got.

@olafurpg
Copy link
Contributor Author

-Ycheck failed after the frontend phase. I opened #2801 adding the debug string to the error message, which now reports

[info] checking /Users/ollie/dev/compiler-benchmark/compilation/src/main/scala/scala/tools/nsc/ScalacBenchmark.scala after phase frontend
exception while typing java.nio.file.Files.walk(this.findSourceDir,
  [java.nio.file.FileVisitOption.FOLLOW_LINKS : java.nio.file.FileVisitOption]:
    Array[java.nio.file.FileVisitOption]
) of class class dotty.tools.dotc.ast.Trees$Apply # 3099
...
found:    Array[java.nio.file.FileVisitOption]
[error] required: java.nio.file.FileVisitOption
[error]
[error]
[error] tree = [java.nio.file.FileVisitOption.FOLLOW_LINKS : java.nio.file.FileVisitOption]:
[error]   Array[java.nio.file.FileVisitOption]

@olafurpg
Copy link
Contributor Author

The Array[nio.file.FileVisitOptions] error appears only with -Ycheck:all. Without -Ycheck, the assertion error becomes

[error] assertion failed: warmups[Unique $ 5]

The codebase has @Warmup annotations here but I couldn't find any references to warmup or unique.

@OlivierBlanvillain OlivierBlanvillain self-assigned this Jun 27, 2017
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Jun 28, 2017
OlivierBlanvillain added a commit to OlivierBlanvillain/dotty that referenced this issue Jun 30, 2017
odersky pushed a commit to dotty-staging/dotty that referenced this issue Jul 10, 2017
odersky added a commit to dotty-staging/dotty that referenced this issue Jul 10, 2017
odersky pushed a commit to odersky/dotty that referenced this issue Jul 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants