-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Inlined parameter name conflict #9342
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
Labels
Comments
Similar, but fails an assertion trait Label[A]:
def apply(v: A): String
def g[A]: Label[A] = _.toString
inline def label[A](x: A, inline l: Label[A]): String = l(x)
def label1[A](v: A) = label(v, g) // Compiles fine
def label2[A](l: A) = label(l, g) // Fails to compile because parameter `l` matches implicit argument name `l` java.lang.AssertionError: assertion failed: Select(TypedSplice(Typed(Inlined(EmptyTree,List(),TypeApply(Ident(g),List(TypeTree[TypeRef(NoPrefix,type A)]))),TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),trait Label),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any)))])),apply) while compiling Foo.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: Select(TypedSplice(Typed(Inlined(EmptyTree,List(),TypeApply(Ident(g),List(TypeTree[TypeRef(NoPrefix,type A)]))),TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),trait Label),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any)))])),apply)
at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
at dotty.tools.dotc.typer.Inliner$InlineTyper.typedSelect(Inliner.scala:1198)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2388)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2478)
at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:124)
at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2548)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2549)
at dotty.tools.dotc.typer.Typer.op$4$$anonfun$1(Typer.scala:2832)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2674)
at dotty.tools.dotc.typer.Typer.op$2(Typer.scala:2834)
at dotty.tools.dotc.typer.Typer.tryInsertImplicitOnQualifier(Typer.scala:2837)
at dotty.tools.dotc.typer.Applications.tryWithImplicitOnQualifier$4(Applications.scala:904)
at dotty.tools.dotc.typer.Applications.realApply$8$$anonfun$7(Applications.scala:958)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2677)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:961)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:999)
... |
Minimized inline def label(x: Int, inline g: Int => String): String = g(x)
def f: Int => String = ???
def label2(g: Int) = label(g, f)
|
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 16, 2020
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 16, 2020
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 17, 2020
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 17, 2020
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 29, 2020
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 10, 2020
nicolasstucki
added a commit
that referenced
this issue
Aug 10, 2020
Fix #9342: Use semantic name for inline bindings
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: