macwire fails to find lazy vals for injection if there is a block comment above them in the publish phase

オープン
#21 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
scala
領域
backend

調査の方向性

リンクされた macwire-bug-demonstration リポジトリを使用して、macwire 0.7.1 と Scala 2.11.2 で失敗を再現する。通常のコンパイルと publish を比較し、Hello.scala に対する macwire のデバッグ出力を調査する。ドキュメント化されたブロックコメントによって publish 中にサービスが見つからなくなることがなくなり、既存のインジェクションが引き続きコンパイルできれば完了とする。

索引モデルが issue の本文から書いたものです。

説明

This is using macwire 0.7.1 and scala 2.11.2.

When we have a code block like this:

/**
  * some comment what this service does.
  */
  lazy val service: Service = MyService

as part of the dependencies, then

  • compiling normally works as expected
  • the publish command, which re-compiles everything, fails to find service in the compilation phase.

The reason is the block comment which seems to interfere with the macros somehow. When the block comment is deleted everything works as expected. Still, this bug is rather annoying when wanting to publish a well-commented library....

publish
[info] Packaging /Users/joe/Documents/git/brokenMacwireParsing/target/scala-2.11/brokenmacwireparsing_2.11-1.0-sources.jar ...
[info] Done packaging.
[info] Packaging /Users/joe/Documents/git/brokenMacwireParsing/target/scala-2.11/brokenmacwireparsing_2.11-1.0.jar ...
[info] Main Scala API documentation to /Users/joe/Documents/git/brokenMacwireParsing/target/scala-2.11/api...
[info] Wrote /Users/joe/Documents/git/brokenMacwireParsing/target/scala-2.11/brokenmacwireparsing_2.11-1.0.pom
[info] Done packaging.
[info] :: delivering :: brokenmacwireparsing#brokenmacwireparsing_2.11;1.0 :: 1.0 :: release :: Fri Oct 10 17:04:11 CEST 2014
[info]  delivering ivy file to /Users/joe/Documents/git/brokenMacwireParsing/target/scala-2.11/ivy-1.0.xml
[debug] Trying to find parameters to create new instance of: [com.example.Hello]
   [debug] Trying to find value [service] of type: [com.example.Service]
      [debug] Looking in the enclosing method
      [debug] Looking in the enclosing class/trait
      [debug] Checking def: [$init$]
      [debug] Checking val: [hello]
      [debug] Looking in parents
      [debug] Checking parent: [AnyRef]
[error] /Users/joe/Documents/git/brokenMacwireParsing/src/main/scala/com/example/Hello.scala:18: Cannot find a value of type: [com.example.Service]
[error]   lazy val hello: Hello = wire[Hello]
[error]  

See the specially created repo reproducing this bug here, including macwire debug output:

https://github.com/jschaul/macwire-bug-demonstration

主要言語
Scala
スター
1.3k
フォーク
77
平均マージ
9分
マージ済み PR(30日)
4

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

softwaremill/macwire のほかの issue

softwaremill/macwire の issue をすべて見る

似ている issue

Scala の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。