Skip to content

Commit 12a5437

Browse files
s/normaliz/simplifi/ in tryCompiletimeConstantFold
This change fixes an issue with tests/pos/i8449.scala. That test does not compiler on master when using `case Any =>` instead of `case _ =>` in the Fibonacci match type. The changes made in this PR expose that bug by parsing the latter into the former.
1 parent d2590f9 commit 12a5437

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -4094,12 +4094,12 @@ object Types {
40944094
def natValue(tp: Type): Option[Int] = intValue(tp).filter(n => n >= 0 && n < Int.MaxValue)
40954095

40964096
def constantFold1[T](extractor: Type => Option[T], op: T => Any): Option[Type] =
4097-
extractor(args.head.normalized).map(a => ConstantType(Constant(op(a))))
4097+
extractor(args.head.simplified).map(a => ConstantType(Constant(op(a))))
40984098

40994099
def constantFold2[T](extractor: Type => Option[T], op: (T, T) => Any): Option[Type] =
41004100
for {
4101-
a <- extractor(args.head.normalized)
4102-
b <- extractor(args.tail.head.normalized)
4101+
a <- extractor(args.head.simplified)
4102+
b <- extractor(args.tail.head.simplified)
41034103
} yield ConstantType(Constant(op(a, b)))
41044104

41054105
trace(i"compiletime constant fold $this", typr, show = true) {

0 commit comments

Comments
 (0)