Skip to content

[do not merge] Issues with TASTY - dotty pickling/unpickling #1202

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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions test/dotc/tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class tests extends CompilerTest {
val runDir = testsDir + "run/"
val newDir = testsDir + "new/"
val replDir = testsDir + "repl/"
val tastyDir = testsDir + "tasty/"
val tastyFailedDir = tastyDir + "failed/"

val sourceDir = "./src/"
val dottyDir = sourceDir + "dotty/"
Expand Down Expand Up @@ -287,4 +289,34 @@ class tests extends CompilerTest {
@Test def tasty_dotc_util = compileDir(dotcDir, "util", testPickling)
@Test def tasty_tools_io = compileDir(toolsDir, "io", testPickling)
@Test def tasty_tests = compileDir(testsDir, "tasty", testPickling)

//TODO - failed TASTY tests
@Test def tasty_runtime_vc = compileDir(s"${dottyDir}runtime/", "vc", testPickling)
@Test def tasty_fail1 = compileFile(tastyFailedDir, "Fail1", testPickling)

//issue with types in import, lazy val imports from Scala
@Test def tasty_fail_backend = compileFile(s"${backendDir}jvm/", "DottyBackendInterface", testPickling)

@Test def tasty_fail_sjs = compileDir(s"${backendDir}", "sjs", testPickling)

@Test def tasty_fail_types = compileFile(coreDir, "Types", testPickling)
@Test def tasty_fail2 = compileFile(tastyFailedDir, "Fail2", testPickling)
//TODO - Fail3.scala - problem with the compilation after unpickling

@Test def tasty_fail_parsers = compileFile(parsingDir, "Parsers", testPickling)
@Test def tasty_fail4 = compileFile(tastyFailedDir, "Fail4", testPickling)

@Test def tasty_fail_repl1 = compileFile(dotcDir + "repl/", "CompilingInterpreter", testPickling)
@Test def tasty_fail5 = compileFile(tastyFailedDir, "Fail5", testPickling)

//var param, issue with order
@Test def tasty_fail6 = compileFile(tastyFailedDir, "Fail6", testPickling)
//TODO - Fail7.scala - problem with unpickling - var param

@Test def tasty_fail_transform = compileFile(s"${dotcDir}transform/", "PatternMatcher", testPickling)
@Test def tasty_fail8 = compileFile(tastyFailedDir, "Fail8", testPickling)
@Test def tasty_fail9 = compileFile(tastyFailedDir, "Fail9", testPickling)

@Test def tasty_fail_typer = compileFile(typerDir, "Namer", testPickling)
@Test def tasty_fail10 = compileFile(tastyFailedDir, "Fail10", testPickling)
}
8 changes: 8 additions & 0 deletions tests/tasty/failed/Fail1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Test[T] {
def testMethod: Unit =
new Foo(this)
}

class Foo[T] {
def this(ct: Test[T]) = this()
}
7 changes: 7 additions & 0 deletions tests/tasty/failed/Fail10.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Fail10 {
Nil foreach {
case cdef =>
Some(true)
case _ =>
}
}
14 changes: 14 additions & 0 deletions tests/tasty/failed/Fail2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Test() {
thisTest => //pickling representation is the same if remove self renaming

import Test._

val myStatus: Status = Unknown

def currentStatus: Status = myStatus
}

object Test {
private type Status = Byte
val Unknown: Status = 0
}
9 changes: 9 additions & 0 deletions tests/tasty/failed/Fail3.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//compilation fails after unpickling
class Test() {
import Test._

val myStatus = Unknown
}
object Test {
private val Unknown: Int = 0 // not yet computed
}
5 changes: 5 additions & 0 deletions tests/tasty/failed/Fail4.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Builder(parser: Parser)

class Parser {
object concreteBuilder extends Builder(this)
}
4 changes: 4 additions & 0 deletions tests/tasty/failed/Fail5.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Fail5 {
val someClass: Class[_] = ???
val resultMethod = someClass.getMethod("result")
}
2 changes: 2 additions & 0 deletions tests/tasty/failed/Fail6.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//different order of getter and setter of in
abstract class Fail6(var in: Int, out: Double)
13 changes: 13 additions & 0 deletions tests/tasty/failed/Fail7.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//Problem with unpickling
//error: class Test needs to be abstract, since <accessor> var in_=: (x$1: Int)Unit is not defined
// (Note that an abstract var requires a setter in addition to the getter)
// one error found
class Fail7(var in: Int)

/*
//This code fails while compiling with -Ycheck:all
//Exception in thread "main" java.lang.AssertionError: assertion failed: method in_$eq is both Deferred and Private
abstract class Fail7(private var in: Int, out: Double) {
val interpreter = 5
}
*/
6 changes: 6 additions & 0 deletions tests/tasty/failed/Fail8.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
trait Fail8 {
val ignoredSubPatBinders: Set[Int]
val storedBinders: Set[Int] =
(if (true) List.empty.toSet else Set.empty) ++ extraStoredBinders -- ignoredSubPatBinders
val extraStoredBinders: Set[Int]
}
2 changes: 2 additions & 0 deletions tests/tasty/failed/Fail9.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//def <init>$default$2(private[this] val param1: scala.Int)
class Fail9(param1: Int)(param2: Boolean = true) //default value should be in second param list, and multiple parameter lists