softwaremill / softwaremill/macwire

AssertionError in compiler

Open
#149 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.3k
Forks
77
Avg merge
9m
Merged PRs (30d)
4

Description

https://scastie.scala-lang.org/OlegYch/BlI4CHhuSGOBXIQdlRJcwg/2

import com.softwaremill.macwire._

case class Config(redis: Int)
case class B(redis: Int)
trait MacWireComponents2 {
  def int: Int
  lazy val config = wire[Config]
  lazy val b   = {
    val redis = config.redis
    B(redis)
  }
}

throws

[error] java.lang.AssertionError: assertion failed:
[error]   transformCaseApply: name = config tree = config / class scala.reflect.internal.Trees$Ident
[error]      while compiling: MacWireComponents2.scala
[error]         during phase: refchecks
[error]      library version: version 2.13.1
[error]     compiler version: version 2.13.1

adding explicit type to config works around it

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Scala 2.13.1 reproducer linked in the issue and inspect the compiler failure during the refchecks phase, especially the transformCaseApply assertion for config. Verify the example and the explicit-type workaround, then confirm that the original code compiles without an AssertionError.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.