From e6706d1e8d73f97ba519f0345f46a8ec2fab4b8e Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Fri, 25 Sep 2015 14:00:27 +0100 Subject: [PATCH 1/3] remove unused code --- src/dotty/tools/dotc/core/Symbols.scala | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala index 2b4f806dd3ee..100f87a54fda 100644 --- a/src/dotty/tools/dotc/core/Symbols.scala +++ b/src/dotty/tools/dotc/core/Symbols.scala @@ -47,13 +47,6 @@ trait Symbols { this: Context => // ---- Symbol creation methods ---------------------------------- - /** Create a symbol from a function producing its denotation */ - def newSymbolDenoting[N <: Name](denotFn: Symbol => SymDenotation, coord: Coord = NoCoord): Symbol { type ThisName = N } = { - val sym = newNakedSymbol[N](coord) - sym.denot = denotFn(sym) - sym - } - /** Create a symbol from its fields (info may be lazy) */ def newSymbol[N <: Name]( owner: Symbol, From 234f3c199936b7eb331954df5c816670f7602ab6 Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Fri, 25 Sep 2015 14:07:14 +0100 Subject: [PATCH 2/3] fix compiling GenBCode.scala companion for a module should always be a class. this commit adds a check when looking for the companion symbol. --- src/dotty/tools/dotc/core/SymDenotations.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 2ce2b8d20db3..960f6b5b62a5 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -885,7 +885,7 @@ object SymDenotations { */ private def companionNamed(name: TypeName)(implicit ctx: Context): Symbol = if (owner.isClass) - owner.info.decl(name).suchThat(_.isCoDefinedWith(symbol)).symbol + owner.info.decl(name).suchThat(x => x.isCoDefinedWith(symbol) && x.isClass && x.symbol.isClass).symbol else if (!owner.exists || ctx.compilationUnit == null) NoSymbol else if (!ctx.compilationUnit.tpdTree.isEmpty) From d55c7cb799f59e6a2a96bec4d84c0487af566d64 Mon Sep 17 00:00:00 2001 From: Sarunas Valaskevicius Date: Fri, 25 Sep 2015 16:51:25 +0100 Subject: [PATCH 3/3] add pos_companions to the suite --- test/dotc/tests.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index b8423db38969..403a99a190b3 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -93,6 +93,7 @@ class tests extends CompilerTest { @Test def pos_packageObj = compileFile(posDir, "i0239", twice) @Test def pos_anonClassSubtyping = compileFile(posDir, "anonClassSubtyping", twice) @Test def pos_extmethods = compileFile(posDir, "extmethods", twice) + @Test def pos_companions = compileFile(posDir, "companions", twice) @Test def pos_all = compileFiles(posDir) // twice omitted to make tests run faster