File tree 2 files changed +14
-17
lines changed
compiler/src/dotty/tools/dotc/transform
2 files changed +14
-17
lines changed Original file line number Diff line number Diff line change @@ -588,16 +588,17 @@ object Erasure {
588
588
tree.withType(erasure(tree.tpe))
589
589
590
590
/** This override is only needed to semi-erase type ascriptions */
591
- override def typedTyped (tree : untpd.Typed , pt : Type )(using Context ): Tree = {
591
+ override def typedTyped (tree : untpd.Typed , pt : Type )(using Context ): Tree =
592
592
val Typed (expr, tpt) = tree
593
- val tpt1 = tpt match {
594
- case Block (_, tpt) => tpt // erase type aliases (statements) from type block
595
- case tpt => tpt
596
- }
597
- val tpt2 = typedType(tpt1)
598
- val expr1 = typed(expr, tpt2.tpe)
599
- assignType(untpd.cpy.Typed (tree)(expr1, tpt2), tpt2)
600
- }
593
+ if tpt.typeOpt.typeSymbol == defn.UnitClass then
594
+ typed(expr, defn.UnitType )
595
+ else
596
+ val tpt1 = tpt match
597
+ case Block (_, tpt) => tpt // erase type aliases (statements) from type block
598
+ case tpt => tpt
599
+ val tpt2 = typedType(tpt1)
600
+ val expr1 = typed(expr, tpt2.tpe)
601
+ assignType(untpd.cpy.Typed (tree)(expr1, tpt2), tpt2)
601
602
602
603
override def typedLiteral (tree : untpd.Literal )(using Context ): Tree =
603
604
if (tree.typeOpt.isRef(defn.UnitClass ))
Original file line number Diff line number Diff line change @@ -3,15 +3,11 @@ package dotty
3
3
object DottyPredef {
4
4
import compiletime .summonFrom
5
5
6
- inline final def assert (inline assertion : Boolean , inline message : => Any ): Unit = {
7
- if (! assertion)
8
- scala.runtime.Scala3RunTime .assertFailed(message)
9
- }
6
+ inline def assert (inline assertion : Boolean , inline message : => Any ): Unit =
7
+ if ! assertion then scala.runtime.Scala3RunTime .assertFailed(message)
10
8
11
- transparent inline final def assert (inline assertion : Boolean ): Unit = {
12
- if (! assertion)
13
- scala.runtime.Scala3RunTime .assertFailed()
14
- }
9
+ inline def assert (inline assertion : Boolean ): Unit =
10
+ if ! assertion then scala.runtime.Scala3RunTime .assertFailed()
15
11
16
12
/**
17
13
* Retrieve the single value of a type with a unique inhabitant.
You can’t perform that action at this time.
0 commit comments