-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make tests pass #623
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
Make tests pass #623
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7bc7c9b
Fix compilation failure by refining adaptation of constants
odersky 78aa682
Revert "Fix #580: use isContainedIn to support cases where the enclos…
odersky d471211
Move test that fails again to disabled.
odersky 3350907
Stop running scala/scala tests instead of our junit tests.
odersky c65504d
Eliminate `_' from rhs of ValDefs
odersky 878b55a
Bring back disabled test.
odersky dd80fe0
New phase: ElimStaticThis
DarkDimius 8f90105
Avoid static initialization deadlock in run tests.
smarter cafd71a
Update t6260-delambdafy.check to account for change in lambda generation
smarter 3d240ad
Fix ElimStaticThis#transformIdent
smarter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package dotty.tools.dotc | ||
package transform | ||
|
||
import core._ | ||
import Contexts.Context | ||
import Flags._ | ||
import dotty.tools.dotc.ast.tpd | ||
import dotty.tools.dotc.core.StdNames._ | ||
import dotty.tools.dotc.core.SymDenotations.SymDenotation | ||
import TreeTransforms.{MiniPhaseTransform, TransformerInfo} | ||
import dotty.tools.dotc.core.Types.{ThisType, TermRef} | ||
import Phases.Phase | ||
|
||
/** Replace This references to module classes in static methods by global identifiers to the | ||
* corresponding modules. | ||
*/ | ||
class ElimStaticThis extends MiniPhaseTransform { | ||
import ast.tpd._ | ||
def phaseName: String = "elimStaticThis" | ||
|
||
override def runsAfter: Set[Class[_ <: Phase]] = Set(classOf[Flatten]) | ||
|
||
override def transformThis(tree: This)(implicit ctx: Context, info: TransformerInfo): Tree = | ||
if (!tree.symbol.is(Package) && ctx.owner.enclosingMethod.is(JavaStatic)) { | ||
assert(tree.symbol.is(ModuleClass)) | ||
ref(tree.symbol.sourceModule) | ||
} | ||
else tree | ||
|
||
override def transformIdent(tree: tpd.Ident)(implicit ctx: Context, info: TransformerInfo): tpd.Tree = { | ||
val meth = ctx.owner.enclosingMethod | ||
// We cannot use meth.enclosingClass because it skips other static classes, | ||
// so instead we require this phase to run after Flatten and use meth.owner | ||
if (meth.is(JavaStatic) && meth.owner.is(ModuleClass)) { | ||
tree.tpe match { | ||
case TermRef(thiz: ThisType, _) if (thiz.underlying.typeSymbol == meth.owner) => | ||
ref(thiz.underlying.typeSymbol.sourceModule).select(tree.symbol) | ||
case _ => tree | ||
} | ||
} | ||
else tree | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
object Test extends dotty.runtime.LegacyApp { | ||
object Test { | ||
val foos = (1 to 1000).toSeq | ||
try | ||
foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i) | ||
catch { | ||
case ex: RuntimeException => println("Runtime exception") | ||
|
||
def main(args: Array[String]): Unit = { | ||
try | ||
foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i) | ||
catch { | ||
case ex: RuntimeException => println("Runtime exception") | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
f(C@2e) | ||
|
||
apply | ||
get$Lambda |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
|
||
|
||
|
||
object Test extends dotty.runtime.LegacyApp { | ||
val x = collection.parallel.mutable.ParArray.range(1,10) groupBy { _ % 2 } mapValues { _.size } | ||
println(x) | ||
val y = collection.parallel.immutable.ParVector.range(1,10) groupBy { _ % 2 } mapValues { _.size } | ||
println(y) | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
val x = collection.parallel.mutable.ParArray.range(1,10) groupBy { _ % 2 } mapValues { _.size } | ||
println(x) | ||
val y = collection.parallel.immutable.ParVector.range(1,10) groupBy { _ % 2 } mapValues { _.size } | ||
println(y) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of
.underlying.termSymbol
it's simpler to use just.cls
.