Skip to content

Make tests for locality of unique indices not depend on order #3358

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 1 commit into from
Oct 20, 2017
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
8 changes: 2 additions & 6 deletions tests/run/i2738.check
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
foo
bar$2
foo
bar$1
baz
Test$qux$1$
baz
Test$qux$2$
bar$1
bar$2
29 changes: 7 additions & 22 deletions tests/run/i2738.scala
Original file line number Diff line number Diff line change
@@ -1,49 +1,34 @@
object Test {

def main(args: Array[String]): Unit = {
foo(1)
foo("a")
baz(2)
baz("b")
List(foo(1), foo("a"), baz(2), baz("b")).sorted.foreach(println)
}

def foo[X <: Int](x: X) = {
def bar = printlnThisMethodName()
printlnThisMethodName()
def bar = thisMethodName()
bar
}

def foo(x: String) = {
def bar = printlnThisMethodName()
printlnThisMethodName()
def bar = thisMethodName()
bar
}

def baz[X <: Int](x: X) = {
object qux {
override def toString() = {
printlnThisMethodsClassName()
"a"
}
override def toString() = thisMethodsClassName()
}
printlnThisMethodName()
qux.toString()
}

def baz(x: String) = {
object qux {
override def toString() = {
printlnThisMethodsClassName()
"b"
}
override def toString() = thisMethodsClassName()
}
printlnThisMethodName()
qux.toString()
}

def printlnThisMethodName() =
println(Thread.currentThread().getStackTrace()(2).getMethodName)
def thisMethodName() = Thread.currentThread().getStackTrace()(2).getMethodName

def printlnThisMethodsClassName() =
println(Thread.currentThread().getStackTrace()(2).getClassName)
def thisMethodsClassName() = Thread.currentThread().getStackTrace()(2).getClassName
}
4 changes: 2 additions & 2 deletions tests/run/i3006.check
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
f$3
f$2
f$1
f$2
f$3
f$1
f$2
17 changes: 7 additions & 10 deletions tests/run/i3006.scala
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
class Foo {
def foo() = {
def f() = println(Thread.currentThread.getStackTrace.apply(1).getMethodName)
def f() = Thread.currentThread.getStackTrace.apply(1).getMethodName
f()
}
def bar() = {
def f() = println(Thread.currentThread.getStackTrace.apply(1).getMethodName)
def f() = Thread.currentThread.getStackTrace.apply(1).getMethodName
f()
}
def baz() = {
def f() = println(Thread.currentThread.getStackTrace.apply(1).getMethodName)
def f() = Thread.currentThread.getStackTrace.apply(1).getMethodName
f()
}
}

class Bar {
def foo() = {
def f() = println(Thread.currentThread.getStackTrace.apply(1).getMethodName)
def f() = Thread.currentThread.getStackTrace.apply(1).getMethodName
f()
}
def bar() = {
def f() = println(Thread.currentThread.getStackTrace.apply(1).getMethodName)
def f() = Thread.currentThread.getStackTrace.apply(1).getMethodName
f()
}
}

object Test {
def main(args: Array[String]): Unit = {
new Foo().foo()
new Foo().bar()
new Foo().baz()
new Bar().foo()
new Bar().bar()
List(new Foo().foo(), new Foo().bar(), new Foo().baz()).sorted.foreach(println)
List(new Bar().foo(), new Bar().bar()).sorted.foreach(println)
}
}
2 changes: 1 addition & 1 deletion tests/run/i3006b.check
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Foo$$init$$$bar$2
Foo$$init$$$bar$1
Foo$$init$$$bar$2
Bar$$init$$$bar$1
27 changes: 9 additions & 18 deletions tests/run/i3006b.scala
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
class Foo(i: Int) {
class Foo(val x: String) {

def this() = this({
def bar() = {
println(Thread.currentThread.getStackTrace.apply(1).getMethodName)
5
}
def bar() = Thread.currentThread.getStackTrace.apply(1).getMethodName
bar()
})

def this(i: String) = this({
def bar() = {
println(Thread.currentThread.getStackTrace.apply(1).getMethodName)
5
}
def this(i: Int) = this({
def bar() = Thread.currentThread.getStackTrace.apply(1).getMethodName
bar()
})
}

class Bar(i: Int) {
class Bar(val x: String) {
def this() = this({
def bar() = {
println(Thread.currentThread.getStackTrace.apply(1).getMethodName)
5
}
def bar() = Thread.currentThread.getStackTrace.apply(1).getMethodName
bar()
})
}

object Test {
def main(args: Array[String]): Unit = {
new Foo()
new Foo("")
new Bar()
List(new Foo().x, new Foo(2).x).sorted.foreach(println)
println(new Bar().x)
}
}