Skip to content

Enable Ycheck after labelDef. Fixes #701 #724

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

Merged
merged 5 commits into from
Jul 22, 2015
Merged
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
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ object DottyBuild extends Build {

val travisMemLimit = List("-Xmx1g", "-Xss2m")

val TRAVIS_BUILD = "dotty.travis.build"
val JENKINS_BUILD = "dotty.jenkins.build"

val agentOptions = List(
// "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
Expand Down Expand Up @@ -104,8 +104,8 @@ object DottyBuild extends Build {
// System.err.println("BOOTPATH: " + fullpath)

val travis_build = // propagate if this is a travis build
if (sys.props.isDefinedAt(TRAVIS_BUILD))
List(s"-D$TRAVIS_BUILD=${sys.props(TRAVIS_BUILD)}") ::: travisMemLimit
if (sys.props.isDefinedAt(JENKINS_BUILD))
List(s"-D$JENKINS_BUILD=${sys.props(JENKINS_BUILD)}") ::: travisMemLimit
else
List()

Expand Down Expand Up @@ -156,8 +156,8 @@ object DottyBuild extends Build {
// System.err.println("BOOTPATH: " + fullpath)

val travis_build = // propagate if this is a travis build
if (sys.props.isDefinedAt(TRAVIS_BUILD))
List(s"-D$TRAVIS_BUILD=${sys.props(TRAVIS_BUILD)}")
if (sys.props.isDefinedAt(JENKINS_BUILD))
List(s"-D$JENKINS_BUILD=${sys.props(JENKINS_BUILD)}")
else
List()
val res = agentOptions ::: travis_build ::: fullpath
Expand Down
2 changes: 1 addition & 1 deletion scripts/common
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ update() {

export LC_ALL=en_US.UTF-8

sbtArgs="-Ddotty.travis.build=yes -Dfile.encoding=UTF-8 -ivy $baseDir/ivy2 -Dsbt.global.base=$HOME/.sbt/0.13 -sbt-dir $HOME/.sbt/0.13"
sbtArgs="-Ddotty.jenkins.build=yes -Dfile.encoding=UTF-8 -ivy $baseDir/ivy2 -Dsbt.global.base=$HOME/.sbt/0.13 -sbt-dir $HOME/.sbt/0.13"
6 changes: 5 additions & 1 deletion src/dotty/tools/dotc/core/Phases.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package core

import Periods._
import Contexts._
import dotty.tools.backend.jvm.GenBCode
import dotty.tools.backend.jvm.{LabelDefs, GenBCode}
import util.DotClass
import DenotTransformers._
import Denotations._
Expand Down Expand Up @@ -296,6 +296,8 @@ object Phases {
private var myFlatClasses = false
private var myRefChecked = false
private var mySymbolicRefs = false
private var myLabelsReordered = false


/** The sequence position of this phase in the given context where 0
* is reserved for NoPhase and the first real phase is at position 1.
Expand All @@ -311,6 +313,7 @@ object Phases {
final def flatClasses = myFlatClasses // Phase is after flatten
final def refChecked = myRefChecked // Phase is after RefChecks
final def symbolicRefs = mySymbolicRefs // Phase is after ResolveSuper, newly generated TermRefs should be symbolic
final def labelsReordered = myLabelsReordered // Phase is after LabelDefs, labels are flattened and owner chains don't mirror this

protected[Phases] def init(base: ContextBase, start: Int, end:Int): Unit = {
if (start >= FirstPhaseId)
Expand All @@ -321,6 +324,7 @@ object Phases {
myFlatClasses = prev.getClass == classOf[Flatten] || prev.flatClasses
myRefChecked = prev.getClass == classOf[RefChecks] || prev.refChecked
mySymbolicRefs = prev.getClass == classOf[ResolveSuper] || prev.symbolicRefs
myLabelsReordered = prev.getClass == classOf[LabelDefs] || prev.labelsReordered
}

protected[Phases] def init(base: ContextBase, id: Int): Unit = init(base, id, id)
Expand Down
3 changes: 2 additions & 1 deletion src/dotty/tools/dotc/transform/TreeChecker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ class TreeChecker extends Phase with SymTransformer {
private def checkOwner(tree: untpd.Tree)(implicit ctx: Context): Unit = {
def ownerMatches(symOwner: Symbol, ctxOwner: Symbol): Boolean =
symOwner == ctxOwner ||
ctxOwner.isWeakOwner && ownerMatches(symOwner, ctxOwner.owner)
ctxOwner.isWeakOwner && ownerMatches(symOwner, ctxOwner.owner) ||
ctx.phase.labelsReordered && symOwner.isWeakOwner && ownerMatches(symOwner.owner, ctxOwner)
assert(ownerMatches(tree.symbol.owner, ctx.owner),
i"bad owner; ${tree.symbol} has owner ${tree.symbol.owner}, expected was ${ctx.owner}\n" +
i"owner chain = ${tree.symbol.ownersIterator.toList}%, %, ctxOwners = ${ctx.outersIterator.map(_.owner).toList}%, %")
Expand Down
11 changes: 8 additions & 3 deletions test/dotc/tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import org.junit.experimental.categories._

class tests extends CompilerTest {

def isRunByJenkins: Boolean = sys.props.isDefinedAt("dotty.jenkins.build")

val noCheckOptions = List(
// "-verbose",
// "-Ylog:frontend",
Expand All @@ -20,9 +22,12 @@ class tests extends CompilerTest {

implicit val defaultOptions = noCheckOptions ++ List(
"-Yno-deep-subtypes", "-Yno-double-bindings",
"-Ycheck:tailrec,resolveSuper,mixin,restoreScopes",
"-d", defaultOutputDir
)
"-d", defaultOutputDir) ++ {
if (isRunByJenkins) List("-Ycheck:-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef") // should be Ycheck:all, but #725
else List("-Ycheck:tailrec,resolveSuper,mixin,restoreScopes,labelDef")
}


val testPickling = List("-Xprint-types", "-Ytest-pickler", "-Ystop-after:pickler")

val twice = List("#runs", "2")
Expand Down