aboutsummaryrefslogtreecommitdiff
path: root/test/dotc/tests.scala
blob: 336c522202f92446d790dd5fc68cad7a47bd76ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package dotc

import org.junit.Test
import test._

class tests extends CompilerTest {

  val noCheckOptions = List(
//        "-verbose",
//         "-Ylog:frontend",
//        "-Xprompt",
//        "-explaintypes",
//        "-Yshow-suppressed-errors",
        "-pagewidth", "160")

  implicit val defaultOptions = noCheckOptions ++ List("-Ycheck:patternMatcher,literalize,capturedVars", "-Ystop-before:erasure"
    /*,"-uniqid", "-explaintypes", "-verbose", "-Ylog:splitter", "-Xprompt", "-YnoDoubleBindings"*/
  )

  val twice = List("#runs", "2", "-YnoDoubleBindings", "-Ystop-before:terminal")
  val doErase = List("-Ystop-before:terminal")

  val posDir = "./tests/pos/"
  val negDir = "./tests/neg/"
  val newDir = "./tests/new/"
  val dotcDir = "./src/dotty/"


  @Test def pos_t2168_pat = compileFile(posDir, "t2168", doErase)
  @Test def pos_erasure = compileFile(posDir, "erasure", doErase)
  @Test def pos_Coder() = compileFile(posDir, "Coder", doErase)
  @Test def pos_blockescapes() = compileFile(posDir, "blockescapes", doErase)
  @Test def pos_collections() = compileFile(posDir, "collections", doErase)
  @Test def pos_functions1() = compileFile(posDir, "functions1", doErase)
  @Test def pos_implicits1() = compileFile(posDir, "implicits1", doErase)
  @Test def pos_inferred() = compileFile(posDir, "inferred", doErase)
  @Test def pos_Patterns() = compileFile(posDir, "Patterns")
  @Test def pos_selftypes() = compileFile(posDir, "selftypes", doErase)
  @Test def pos_varargs() = compileFile(posDir, "varargs", doErase)
  @Test def pos_opassign() = compileFile(posDir, "opassign", doErase)
  @Test def pos_typedapply() = compileFile(posDir, "typedapply", doErase)
  @Test def pos_nameddefaults() = compileFile(posDir, "nameddefaults", doErase)
  @Test def pos_desugar() = compileFile(posDir, "desugar", doErase)
  @Test def pos_sigs() = compileFile(posDir, "sigs", doErase)
  @Test def pos_typers() = compileFile(posDir, "typers", doErase)

  @Test def pos_typedidents() = compileFile(posDir, "typedIdents", doErase)
  @Test def pos_assignments() = compileFile(posDir, "assignments", doErase)
  @Test def pos_packageobject() = compileFile(posDir, "packageobject", doErase)
  @Test def pos_overloaded() = compileFile(posDir, "overloaded", doErase)
  @Test def pos_templateParents() = compileFile(posDir, "templateParents", doErase)
  @Test def pos_structural() = compileFile(posDir, "structural", doErase)
  @Test def pos_overloadedAccess = compileFile(posDir, "overloadedAccess", doErase)
  @Test def pos_approximateUnion = compileFile(posDir, "approximateUnion", doErase)
  @Test def pos_tailcall = compileDir(posDir + "tailcall/", doErase)
  @Test def pos_nullarify = compileFile(posDir, "nullarify", "-Ycheck:nullarify" :: doErase)

  @Test def pos_all = compileFiles(posDir, twice)
  @Test def new_all = compileFiles(newDir, twice)

  @Test def neg_blockescapes() = compileFile(negDir, "blockescapesNeg", xerrors = 1)
  @Test def neg_typedapply() = compileFile(negDir, "typedapply", xerrors = 4)
  @Test def neg_typedidents() = compileFile(negDir, "typedIdents", xerrors = 2)
  @Test def neg_assignments() = compileFile(negDir, "assignments", xerrors = 3)
  @Test def neg_typers() = compileFile(negDir, "typers", xerrors = 13)
  @Test def neg_privates() = compileFile(negDir, "privates", xerrors = 2)
  @Test def neg_rootImports = compileFile(negDir, "rootImplicits", xerrors = 2)
  @Test def neg_templateParents() = compileFile(negDir, "templateParents", xerrors = 3)
  @Test def neg_autoTupling = compileFile(posDir, "autoTuplingTest", "-language:noAutoTupling" :: Nil, xerrors = 4)
  @Test def neg_autoTupling2 = compileFile(negDir, "autoTuplingTest", xerrors = 4)
  @Test def neg_companions = compileFile(negDir, "companions", xerrors = 1)
  @Test def neg_projections = compileFile(negDir, "projections", xerrors = 1)
  @Test def neg_i39 = compileFile(negDir, "i39", xerrors = 1)
  @Test def neg_i50_volatile = compileFile(negDir, "i50-volatile", xerrors = 4)
  @Test def neg_t0273_doubledefs = compileFile(negDir, "t0273", xerrors = 1)
  @Test def neg_t0586_structural = compileFile(negDir, "t0586", xerrors = 1)
  @Test def neg_t0625_structural = compileFile(negDir, "t0625", xerrors = 1)(
      defaultOptions = noCheckOptions)
        // -Ycheck fails because there are structural types involving higher-kinded types.
        // these are illegal, but are tested only later.
  @Test def neg_t1131_structural = compileFile(negDir, "t1131", xerrors = 1)
  @Test def neg_zoo = compileFile(negDir, "zoo", xerrors = 1)
  @Test def neg_t1192_legalPrefix = compileFile(negDir, "t1192", xerrors = 1)
  @Test def neg_tailcall_t1672b = compileFile(negDir, "tailcall/t1672b", xerrors = 6)
  @Test def neg_tailcall_t3275 = compileFile(negDir, "tailcall/t3275", xerrors = 1)
  @Test def neg_tailcall_t6574 = compileFile(negDir, "tailcall/t6574", xerrors = 2)
  @Test def neg_tailcall = compileFile(negDir, "tailcall/tailrec", xerrors = 7)
  @Test def neg_tailcall2 = compileFile(negDir, "tailcall/tailrec-2", xerrors = 2)
  @Test def neg_tailcall3 = compileFile(negDir, "tailcall/tailrec-3", xerrors = 2)
  @Test def neg_t1048 = compileFile(negDir, "t1048", xerrors = 1)
  @Test def nef_t1279a = compileFile(negDir, "t1279a", xerrors = 1)
  @Test def neg_t1843 = compileFile(negDir, "t1843", xerrors = 1)
  @Test def neg_t1843_variances = compileFile(negDir, "t1843-variances", xerrors = 1)
  @Test def neg_t2994 = compileFile(negDir, "t2994", xerrors = 2)
  @Test def neg_variances = compileFile(negDir, "variances", xerrors = 2)
  @Test def neg_badAuxConstr = compileFile(negDir, "badAuxConstr", xerrors = 2)
  @Test def neg_typetest = compileFile(negDir, "typetest", xerrors = 1)

  @Test def dotc = compileDir(dotcDir + "tools/dotc", twice)
  @Test def dotc_ast = compileDir(dotcDir + "tools/dotc/ast", twice)
  @Test def dotc_config = compileDir(dotcDir + "tools/dotc/config", twice)
  @Test def dotc_core = compileDir(dotcDir + "tools/dotc/core", twice)
  // @Test def dotc_core_pickling = compileDir(dotcDir + "tools/dotc/core/pickling", twice)
  // @odesky, fails on assertion in TypeComparer:425

  @Test def dotc_core_transform = compileDir(dotcDir + "tools/dotc/core/transform", twice)

  //@Test def dotc_transform = compileDir(dotcDir + "tools/dotc/transform", twice)
  // @odersky, fails with datarace

  @Test def dotc_parsing = compileDir(dotcDir + "tools/dotc/parsing", twice)
  // @Test def dotc_printing = compileDir(dotcDir + "tools/dotc/printing", twice)
  // @odersky, elimByName creates symbol with incorrect owner

  @Test def dotc_reporting = compileDir(dotcDir + "tools/dotc/reporting", twice)
  // @Test def dotc_typer = compileDir(dotcDir + "tools/dotc/typer", twice)
  // @odersky, elimByName creates symbol with incorrect owner

  @Test def dotc_util = compileDir(dotcDir + "tools/dotc/util", twice)
  @Test def tools_io = compileDir(dotcDir + "tools/io", twice)
  @Test def tools = compileDir(dotcDir + "tools", twice)

  @Test def testNonCyclic = compileArgs(Array(
      dotcDir + "tools/dotc/CompilationUnit.scala",
      dotcDir + "tools/dotc/core/Types.scala",
      dotcDir + "tools/dotc/ast/Trees.scala",
      //"-Ylog:frontend",
      "-Xprompt",
      "#runs", "2"))


  @Test def testIssue_34 = compileArgs(Array(
      dotcDir + "tools/dotc/config/Properties.scala",
      dotcDir + "tools/dotc/config/PathResolver.scala",
      //"-Ylog:frontend",
      "-Xprompt",
      "#runs", "2"))

  //@Test def dotc_compilercommand = compileFile(dotcDir + "tools/dotc/config/", "CompilerCommand")
}