Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ object Checking {
report.error(ValueClassesMayNotDefineNonParameterField(clazz, stat.symbol), stat.srcPos)
case _: DefDef if stat.symbol.isConstructor =>
report.error(ValueClassesMayNotDefineASecondaryConstructor(clazz, stat.symbol), stat.srcPos)
case _: MemberDef | _: Import | EmptyTree =>
case _: MemberDef | _: Import | _: Export | EmptyTree =>
// ok
case _ =>
report.error(ValueClassesMayNotContainInitalization(clazz), stat.srcPos)
Expand Down
1 change: 1 addition & 0 deletions tests/run/export-anyval.check
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello from export
12 changes: 12 additions & 0 deletions tests/run/export-anyval.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Foo(val x: String)


class Bar(val y: Foo) extends AnyVal:
export y.*
def foo: String = x
end Bar

@main def Test =
val a = Bar(Foo("Hello from export"))
println(a.foo)

Loading