Skip to content

Regression for opaque types + -Yexplicit-nulls #24599

@WojciechMazur

Description

@WojciechMazur

Based on the OpenCB failure in shuwariafrica/world - Open CB logs

Compiler version

Last good release: 3.8.0-RC1-bin-20251011-be16a7b-NIGHTLY
First bad release: 3.8.0-RC1-bin-20251012-89e617d-NIGHTLY
Bisect points to 89e617d

Minimized code

//> using options -Yexplicit-nulls

opaque type CurrencyValue = BigDecimal

extension (value: CurrencyValue)
  def negate: CurrencyValue = value.bigDecimal.negate().nn

Output

scala compile test.macro.scala -S 3.nightly
Compiling project (Scala 3.8.1-RC1-bin-20251130-2953eab-NIGHTLY, JVM (21))
[error] ./test.macro.scala:7:5
[error] value nn is not a member of (java.math.BigDecimal)?.
[error] An extension method was tried, but could not be fully constructed:
[error] 
[error]     nn[(java.math.BigDecimal)?](value.bigDecimal.negate())
[error] 
[error]     failed with:
[error] 
[error]         Found:    (?1 : (java.math.BigDecimal)?)
[error]         Required: CurrencyValue
[error]         
[error]         where:    ?1 is an unknown value of type (java.math.BigDecimal)?
[error]         
[error]     value.bigDecimal.negate().nn
[error]     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error compiling project (Scala 3.8.1-RC1-bin-20251130-2953eab-NIGHTLY, JVM (21))

Expectation

Should compile

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions