8000 Macro expansion error in `suiteAll` when defining local defs · Issue #9271 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Macro expansion error in suiteAll when defining local defs #9271
Closed
@jasnross

Description

@jasnross

In Scala 3 when defining anything other than a val in suiteAll there is a macro expansion error.

I'm not sure if this is a bug or intended, but it works fine when using 2.13.

Scala Version: 3.5.1
ZIO Version: 2.0.11
ZIO Test Version: 2.0.11

import zio._
import zio.stream._
import zio.test._

object ExampleSpec extends ZIOSpecDefault {
  override def spec: Spec[Any, Any] = suiteAll("ExampleSpec") {
    // Works
    val one = 1

    // Does not work
    def two = 2

    test("temp") {
      assertNever("testing")
    } @@ TestAspect.ignore
  }
}
[error] -- Error: /Users/jaross/Projects/tmp/zio-scala3-quickstart/src/test/scala/com/example/ExampleSpec.scala:8:62 
[error]  8 |  override def spec: Spec[Any, Any] = suiteAll("ExampleSpec") {
[error]    |                                      ^
[error]    |Exception occurred while executing macro expansion.
[error]    |java.lang.Error: UNHANDLED: DefDef(two,List(),TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],Literal(Constant(2)))
[error]    |	at zio.test.ZIOSpecVersionSpecificMacros$.collectTests$1(ZIOSpecVersionSpecific.scala:36)
[error]    |	at zio.test.ZIOSpecVersionSpecificMacros$.collectTests$1$$anonfun$1(ZIOSpecVersionSpecific.scala:27)
[error]    |	at scala.collection.immutable.List.flatMap(List.scala:294)
[error]    |	at zio.test.ZIOSpecVersionSpecificMacros$.collectTests$1(ZIOSpecVersionSpecific.scala:27)
[error]    |	at zio.test.ZIOSpecVersionSpecificMacros$.suiteAllImpl(ZIOSpecVersionSpecific.scala:78)
[error]    |
[error]  9 |    // Works
[error] 10 |    val 
[error] 11 |    // Does not work
[error] 12 |    def two = 2
[error] 13 |    test("temp") {
[error] 14 |      assertNever("testing")
[error] 15 |    } @@ TestAspect.ignore
[error] 16 |  }
[error]    |----------------------------------------------------------------------------
[error]    |Inline stack trace
[error]    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[error]    |This location contains code that was inlined from ZIOSpecVersionSpecific.scala:8
[error]     ----------------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0