Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regresion in theiterators/kebs - implicit search in multiple compilation units #19417

Closed
WojciechMazur opened this issue Jan 10, 2024 · 0 comments · Fixed by #19411
Closed

Regresion in theiterators/kebs - implicit search in multiple compilation units #19417

WojciechMazur opened this issue Jan 10, 2024 · 0 comments · Fixed by #19411
Assignees
Labels
area:implicits related to implicits itype:bug regression This worked in a previous version but doesn't anymore

Comments

@WojciechMazur
Copy link
Contributor

Regression found in the Open Community Build for theiterators/kebs - build logs

Compiler is not able to find implicit instance if it was defined in different compilation unit and if there exists implicit method returning the same but requiring some additional implicit context

Compiler version

Last good release: 3.4.0-RC1-bin-20231221-beaf7b4-NIGHTLY
First bad release: 3.4.0-RC1-bin-20231223-938d405-NIGHTLY
Bisect points to ed9f427

3.3.2-RC1 and 3.4.0-RC1 not affected

Minimized code

Requires 2 compilation units:

// defn_1.scala

trait QueryParamDecoder[E]:
  def emap[T](fn: E => Either[Throwable, T]): QueryParamDecoder[T]
object QueryParamDecoder:
  def apply[T](implicit ev: QueryParamDecoder[T]): QueryParamDecoder[T] = ev
  implicit lazy val stringQueryParamDecoder: QueryParamDecoder[String] = ???
// usage_2.scala

given[E](using e: EnumOf[E]): QueryParamDecoder[E] = QueryParamDecoder[String].emap(_ => Right(???))
trait EnumOf[E]

Output

-- [E172] Type Error: /Users/wmazur/projects/dotty/bisect/main.test.scala:2:78 -
2 |given[E](using e: EnumOf[E]): QueryParamDecoder[E] = QueryParamDecoder[String].emap(_ => Right(???))
  |                                                                              ^
  |No given instance of type QueryParamDecoder[String] was found for parameter ev of method apply in object QueryParamDecoder.
  |I found:
  |
  |    given_QueryParamDecoder_E[String](/* missing */summon[EnumOf[String]])
  |
  |But no implicit values were found that match type EnumOf[String].

Expectation

Should compile

@WojciechMazur WojciechMazur added itype:bug area:implicits related to implicits regression This worked in a previous version but doesn't anymore labels Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:implicits related to implicits itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants