aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorodersky <odersky@gmail.com>2016-11-18 11:10:18 +0100
committerGitHub <noreply@github.com>2016-11-18 11:10:18 +0100
commit601a286b1c1eb7f0bbea64609a7d07ed40f02118 (patch)
tree246785d0e0b40cf1f958381cdcd71a5e932be6d4
parentdd0db48342b3ccc773373870f36348de846c66e4 (diff)
parent9f8c81c382ad996693c0460e335bc8911d660442 (diff)
downloaddotty-601a286b1c1eb7f0bbea64609a7d07ed40f02118.tar.gz
dotty-601a286b1c1eb7f0bbea64609a7d07ed40f02118.tar.bz2
dotty-601a286b1c1eb7f0bbea64609a7d07ed40f02118.zip
Merge pull request #1724 from dotty-staging/fix-i1648
Fix #1648: don't define companion object for java.lang.Object
-rw-r--r--src/dotty/tools/dotc/core/Definitions.scala7
-rw-r--r--tests/neg/i1648.scala1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Definitions.scala b/src/dotty/tools/dotc/core/Definitions.scala
index 4e9518a2a..4b090d9b1 100644
--- a/src/dotty/tools/dotc/core/Definitions.scala
+++ b/src/dotty/tools/dotc/core/Definitions.scala
@@ -194,6 +194,13 @@ class Definitions {
val cls = ctx.requiredClass("java.lang.Object")
assert(!cls.isCompleted, "race for completing java.lang.Object")
cls.info = ClassInfo(cls.owner.thisType, cls, AnyClass.typeRef :: Nil, newScope)
+
+ // The companion object doesn't really exist, `NoType` is the general
+ // technique to do that. Here we need to set it before completing
+ // attempt to load Object's classfile, which causes issue #1648.
+ val companion = JavaLangPackageVal.info.decl(nme.Object).symbol
+ companion.info = NoType // to indicate that it does not really exist
+
completeClass(cls)
}
def ObjectType = ObjectClass.typeRef
diff --git a/tests/neg/i1648.scala b/tests/neg/i1648.scala
new file mode 100644
index 000000000..52ba78a2d
--- /dev/null
+++ b/tests/neg/i1648.scala
@@ -0,0 +1 @@
+class Foo { Object[A] } // error // error