Skip to content

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

Closed
@WojciechMazur

Description

@WojciechMazur

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

Metadata

Metadata

Assignees

Labels

area:implicitsrelated to implicitsitype:bugregressionThis worked in a previous version but doesn't anymore

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions