Skip to content

Commit

Permalink
Add test for footprint optimization related to secondary constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
liufengyun committed Sep 15, 2024
1 parent c52f418 commit 575eb0a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/init-global/pos/footprint-2nd-ctor.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Box[T](var value: T)

class A:
var box = new Box[Int](10)

def update(n: Int) =
box.value = n

def this(n: Int) =
this()
box.value = n

class B(n: Int) extends A(n):
this.update(n * n)

object A:
val a = new B(20)

0 comments on commit 575eb0a

Please sign in to comment.