Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
liufengyun committed Mar 26, 2021
1 parent abcadcf commit c177b8d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ class CheckGlobal {
else {
val cdef = cls.defTree.asInstanceOf[TypeDef]
val tpl = cdef.rhs.asInstanceOf[Template]

// ignore separately compiled classes
if !tpl.unforced.isInstanceOf[List[_]] then return Nil

var dependencies: List[Dependency] = Nil
val traverser = new TreeTraverser {
override def traverse(tree: Tree)(using Context): Unit =
Expand Down
15 changes: 15 additions & 0 deletions tests/init/neg/t5366.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class IdAndMsg(val id: Int, val msg: String = "")

case object ObjA extends IdAndMsg(1) // error
case object ObjB extends IdAndMsg(2) // error

object IdAndMsg { // error
val values = List(ObjA , ObjB)
}

object Test {
def main(args: Array[String]): Unit = {
ObjA
println(IdAndMsg.values)
}
}
File renamed without changes.

0 comments on commit c177b8d

Please sign in to comment.