Skip to content

Conversation

@eejbyfeldt
Copy link
Contributor

@eejbyfeldt eejbyfeldt commented Dec 9, 2025

This uses TypeComparer.constValue to extract the constant in TypeEval.
This is also how constValue is implemented. So I think also using it in
TypeEval make behavior around this more consistent and predictable.

This fixes: #24717

This uses `TypeComparer.constValue` to extract the constant in TypeEval.
This is also how constValue is implemented. So I think also using it in
TypeEval make behavior around this more consistent and predictable.

This fixes: scala#24717

val a: 123 & O.O = O.v
val b: S[a.type] = 124
val c: a.type + 1 = 124
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces some inconsistency as

val d: a.type + 1 = a + 1

will still not compiles as a + 1 does not get constant folded.

Should ConstFold also use TypeComparer for extracting the constant type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Difference in behavior between S[a.type] and a.type + 1

1 participant