Skip to content

[2.13.9, 2.13.10] Issue with zio-prelude 1.0.0-RC8-1 (zio1) macros #12647

Closed
scala/scala
#10188
@guizmaii

Description

@guizmaii

There's an issue between Scala 2.13.9 and zio-prelude 1.0.0-RC8-1 (last version published supporting ZIO1) macros:

import zio.prelude.*

object LongNatural extends Subtype[Long] {
  //noinspection TypeAnnotation                            // IntelliJ annnotation
  @SuppressWarnings(Array("scalafix:ExplicitResultTypes")) // scalafix annotation
  override def assertion = assert(greaterThanOrEqualTo(0L))

  def zero: LongNatural = LongNatural(0L)
}

is failing to compile with the following error:

[error]  Newtype Assertion Failed 
[error] We were unable to read your assertion at compile-time.
[error] This is because you have annotated `def assertion` with its type signature:
[error] 
[error]     override def assertion: QuotedAssertion[Long] = assert(...)
[error]    
[error] Due to the macro machinery powering this feature, you MUST NOT ANNOTATE this method. 
[error] Try deleting the type annotation and recompiling. Something like:
[error] 
[error]     override def assertion = assert(...)
[error]     
[error]     def zero: LongNatural = LongNatural(0L)
[error]                                        ^

This was compiling fine with Scala 2.13.8.
Note that we're using the -Xsource:3 flag.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions