Skip to content

Commit 0e71743

Browse files
committed
Implement implicit defs that return class tags for value classes.
1 parent 744ffb5 commit 0e71743

9 files changed

+18
-0
lines changed

src/dotty/runtime/vc/VCBooleanPrototype.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ abstract class VCBooleanCasePrototype(underlying: Boolean) extends VCBooleanProt
2424
abstract class VCBooleanCompanion[T <: VCBooleanPrototype] extends ClassTag[T] {
2525
def box(underlying: Boolean): T
2626
final def unbox(boxed: T) = boxed.underlying
27+
28+
implicit def classTag: this.type = this
2729
override def newArray(len: Int): Array[T] =
2830
new VCBooleanArray(this, len).asInstanceOf[Array[T]]
2931

src/dotty/runtime/vc/VCBytePrototype.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ abstract class VCByteCasePrototype(underlying: Byte) extends VCBytePrototype(und
2424
abstract class VCByteCompanion[T <: VCBytePrototype] extends ClassTag[T] {
2525
def box(underlying: Byte): T
2626
final def unbox(boxed: T) = boxed.underlying
27+
28+
implicit def classTag: this.type = this
2729
override def newArray(len: Int): Array[T] =
2830
new VCByteArray(this, len).asInstanceOf[Array[T]]
2931

src/dotty/runtime/vc/VCCharPrototype.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ abstract class VCCharCasePrototype(underlying: Char) extends VCCharPrototype(und
2424
abstract class VCCharCompanion[T <: VCCharPrototype] extends ClassTag[T] {
2525
def box(underlying: Char): T
2626
final def unbox(boxed: T) = boxed.underlying
27+
28+
implicit def classTag: this.type = this
2729
override def newArray(len: Int): Array[T] =
2830
new VCCharArray(this, len).asInstanceOf[Array[T]]
2931

src/dotty/runtime/vc/VCDoublePrototype.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ abstract class VCDoubleCasePrototype(underlying: Double) extends VCDoublePrototy
2424
abstract class VCDoubleCompanion[T <: VCDoublePrototype] extends ClassTag[T] {
2525
def box(underlying: Double): T
2626
final def unbox(boxed: T) = boxed.underlying
27+
28+
implicit def classTag: this.type = this
2729
override def newArray(len: Int): Array[T] =
2830
new VCDoubleArray(this, len).asInstanceOf[Array[T]]
2931

src/dotty/runtime/vc/VCFloatPrototype.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ abstract class VCFloatCasePrototype(underlying: Float) extends VCFloatPrototype(
2424
abstract class VCFloatCompanion[T <: VCFloatPrototype] extends ClassTag[T] {
2525
def box(underlying: Float): T
2626
final def unbox(boxed: T) = boxed.underlying
27+
28+
implicit def classTag: this.type = this
2729
override def newArray(len: Int): Array[T] =
2830
new VCFloatArray(this, len).asInstanceOf[Array[T]]
2931

src/dotty/runtime/vc/VCIntPrototype.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ abstract class VCIntCasePrototype(underlying: Int) extends VCIntPrototype(underl
2424
abstract class VCIntCompanion[T <: VCIntPrototype] extends ClassTag[T] {
2525
def box(underlying: Int): T
2626
final def unbox(boxed: T) = boxed.underlying
27+
28+
implicit def classTag: this.type = this
2729
override def newArray(len: Int): Array[T] =
2830
new VCIntArray(this, len).asInstanceOf[Array[T]]
2931

src/dotty/runtime/vc/VCLongPrototype.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ abstract class VCLongCasePrototype(underlying: Long) extends VCLongPrototype(und
2424
abstract class VCLongCompanion[T <: VCLongPrototype] extends ClassTag[T] {
2525
def box(underlying: Long): T
2626
final def unbox(boxed: T) = boxed.underlying
27+
28+
implicit def classTag: this.type = this
2729
override def newArray(len: Int): Array[T] =
2830
new VCLongArray(this, len).asInstanceOf[Array[T]]
2931

src/dotty/runtime/vc/VCObjectPrototype.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ abstract class VCObjectCasePrototype(underlying: Object) extends VCObjectPrototy
2424
abstract class VCObjectCompanion[T <: VCObjectPrototype] extends ClassTag[T] {
2525
def box(underlying: Object): T
2626
final def unbox(boxed: T) = boxed.underlying
27+
28+
implicit def classTag: this.type = this
2729
override def newArray(len: Int): Array[T] =
2830
new VCObjectArray(this, len).asInstanceOf[Array[T]]
2931

src/dotty/runtime/vc/VCShortPrototype.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ abstract class VCShortCasePrototype(underlying: Short) extends VCShortPrototype(
2424
abstract class VCShortCompanion[T <: VCShortPrototype] extends ClassTag[T] {
2525
def box(underlying: Short): T
2626
final def unbox(boxed: T) = boxed.underlying
27+
28+
implicit def classTag: this.type = this
2729
override def newArray(len: Int): Array[T] =
2830
new VCShortArray(this, len).asInstanceOf[Array[T]]
2931

0 commit comments

Comments
 (0)