diff --git a/compiler/src/dotty/tools/dotc/core/Flags.scala b/compiler/src/dotty/tools/dotc/core/Flags.scala index 479b6753a09e..67dc4e6fe687 100644 --- a/compiler/src/dotty/tools/dotc/core/Flags.scala +++ b/compiler/src/dotty/tools/dotc/core/Flags.scala @@ -290,7 +290,9 @@ object Flags { final val PackageVal: FlagSet = Package.toTermFlags final val PackageClass: FlagSet = Package.toTypeFlags - /** A case class or its companion object */ + /** A case class or its companion object + * Note: Case is also used to indicate that a symbol is bound by a pattern. + */ final val Case: FlagSet = commonFlag(17, "case") final val CaseClass: FlagSet = Case.toTypeFlags final val CaseVal: FlagSet = Case.toTermFlags diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index ef22e72bc82d..8ac375029eff 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -513,7 +513,7 @@ class TreeUnpickler(reader: TastyReader, def complete(denot: SymDenotation)(implicit ctx: Context) = denot.info = typeReader.readType() } - val sym = ctx.newSymbol(ctx.owner, name, EmptyFlags, completer, coord = coordAt(start)) + val sym = ctx.newSymbol(ctx.owner, name, Flags.Case, completer, coord = coordAt(start)) registerSym(start, sym) sym } diff --git a/tests/pos/inline-match-separate/inline-match-separate_1.scala b/tests/pos/inline-match-separate/inline-match-separate_1.scala new file mode 100644 index 000000000000..667ac73edcfd --- /dev/null +++ b/tests/pos/inline-match-separate/inline-match-separate_1.scala @@ -0,0 +1,6 @@ +object Utils { + class Box[T] + inline def foo[T](t: T) <: Any = inline t match { + case _: Box[a] => scala.compiletime.constValue[a] + } +} diff --git a/tests/pos/inline-match-separate/inline-match-separate_2.scala b/tests/pos/inline-match-separate/inline-match-separate_2.scala new file mode 100644 index 000000000000..b2d43fceb3b1 --- /dev/null +++ b/tests/pos/inline-match-separate/inline-match-separate_2.scala @@ -0,0 +1,5 @@ +import Utils._ + +object Test { + val a = foo(new Box["a"]) +}