From ca6e3752e60236a365110b77a68888cb38571568 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 13 Jan 2021 19:16:33 +0100 Subject: [PATCH] Handle abstract inline methods in TreeUnpickler Fixes #11075 --- compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala | 2 +- tests/pos/i11075/A_1.scala | 3 +++ tests/pos/i11075/B_2.scala | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tests/pos/i11075/A_1.scala create mode 100644 tests/pos/i11075/B_2.scala diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index 1c58ec570f24..c00888444ac2 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -602,7 +602,7 @@ class TreeUnpickler(reader: TastyReader, sym.completer.withDecls(newScope) forkAt(templateStart).indexTemplateParams()(using localContext(sym)) } - else if (sym.isInlineMethod) + else if (sym.isInlineMethod && !sym.is(Deferred)) sym.addAnnotation(LazyBodyAnnotation { (ctx0: Context) ?=> val ctx1 = localContext(sym)(using ctx0).addMode(Mode.ReadPositions) inContext(sourceChangeContext(Addr(0))(using ctx1)) { diff --git a/tests/pos/i11075/A_1.scala b/tests/pos/i11075/A_1.scala new file mode 100644 index 000000000000..c63b1017e898 --- /dev/null +++ b/tests/pos/i11075/A_1.scala @@ -0,0 +1,3 @@ +trait A { + inline def a: Int +} diff --git a/tests/pos/i11075/B_2.scala b/tests/pos/i11075/B_2.scala new file mode 100644 index 000000000000..e39a2222dc0f --- /dev/null +++ b/tests/pos/i11075/B_2.scala @@ -0,0 +1,3 @@ +trait B extends A { + inline def a: Int = 0 +}