diff options
author | Paul Phillips <paulp@improving.org> | 2013-03-22 11:12:46 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-03-22 11:12:46 -0700 |
commit | 54f1a3998e84d238d3f8879af83cbb09858475c4 (patch) | |
tree | 3727dcbb7fab5085155835e9a48cde559c2a5bd9 /test | |
parent | 2f3a7fa417f7ba92251fdae53e5548f081c2fd04 (diff) | |
parent | 2b5fde7ef9b202e8d4ba94d93d1b91b90e14d42f (diff) | |
download | scala-54f1a3998e84d238d3f8879af83cbb09858475c4.tar.gz scala-54f1a3998e84d238d3f8879af83cbb09858475c4.tar.bz2 scala-54f1a3998e84d238d3f8879af83cbb09858475c4.zip |
Merge pull request #2245 from retronym/ticket/7242
SI-7242 Fix crash when inner object mixes in its companion
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t3994.scala | 20 | ||||
-rw-r--r-- | test/files/run/t7242.scala | 71 |
2 files changed, 91 insertions, 0 deletions
diff --git a/test/files/run/t3994.scala b/test/files/run/t3994.scala new file mode 100644 index 0000000000..0ee1d9d966 --- /dev/null +++ b/test/files/run/t3994.scala @@ -0,0 +1,20 @@ +trait T { + trait Default { def foo = this } + object Default extends Default +} + +class Crash { // if you change this to a `trait` it keeps failing, though if it is an `object` it compiles just fine! + class Element + + /* declare this as a class, and the crash goes away */ + trait ElementOrdering extends Ordering[Element] { + def compare(a: Element, b: Element): Int = 0 + } + + implicit object ElementOrdering extends ElementOrdering +} + +object Test extends App { + (new T {}).Default + (new Crash).ElementOrdering +} diff --git a/test/files/run/t7242.scala b/test/files/run/t7242.scala new file mode 100644 index 0000000000..c995336144 --- /dev/null +++ b/test/files/run/t7242.scala @@ -0,0 +1,71 @@ +class CrashTest { + def foo = () + trait CrashTestTable { + def cols = foo + } + // This was leading to a class between the mixed in + // outer accessor and the outer accessor of this object. + object CrashTestTable extends CrashTestTable { + foo + cols + } +} + +class CrashTest1 { + def foo = () + class CrashTestTable { + def cols = foo + } + object CrashTestTable extends CrashTestTable { + foo + cols + } +} + +class CrashTest2 { + def foo = () + trait CrashTestTable { + def cols = foo + } + object Obj extends CrashTestTable { + foo + cols + } +} + +class CrashTest3 { + def foo = () + + def meth() { + trait CrashTestTable { + def cols = foo + } + object Obj extends CrashTestTable { + foo + cols + } + Obj + } +} + +object Test extends App { + { + val c = new CrashTest + c.CrashTestTable + } + + { + val c = new CrashTest1 + c.CrashTestTable + } + + { + val c = new CrashTest2 + c.Obj + } + + { + val c = new CrashTest3 + c.meth() + } +} |