Last active
August 10, 2019 10:00
-
-
Save ingarabr/c8c81fb2f2e0ad05bbeb882d39de04c1 to your computer and use it in GitHub Desktop.
Unable to find implicit argument in with scalafix/scalameta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fix | |
object ScalafixImplicitArgs { | |
trait Value[A] { def value: A } | |
implicit val intValue: Value[Int] = new Value[Int] { def value: Int = 1 } | |
class Foo[A]() { | |
def parentheses[AA >: A]()(implicit s: Value[AA]): AA = s.value | |
def noParentheses[AA >: A](implicit s: Value[AA]): AA = s.value | |
} | |
private val foo = new Foo[Int]() | |
foo.parentheses() | |
foo.noParentheses | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source(List( | |
Pkg( | |
Term.Name("fix"), | |
List( | |
Defn.Object( | |
List(), | |
Term.Name("ScalafixImplicitArgs"), | |
Template( | |
List(), | |
List(), | |
Self(Name.Anonymous, None), | |
List( | |
Defn.Trait( | |
List(), | |
Type.Name("Value"), | |
List( | |
Type.Param( | |
List(), | |
Type.Name("A"), | |
List(), | |
Type.Bounds(None, None), | |
List(), | |
List() | |
) | |
), | |
Ctor.Primary(List(), Name.Anonymous, List()), | |
Template( | |
List(), | |
List(), | |
Self(Name.Anonymous, None), | |
List( | |
Decl.Def( | |
List(), | |
Term.Name("value"), | |
List(), | |
List(), | |
Type.Name("A") | |
) | |
) | |
) | |
), | |
Defn.Val( | |
List(Mod.Implicit), | |
List(Pat.Var(Term.Name("intValue"))), | |
Some(Type.Apply(Type.Name("Value"), List(Type.Name("Int")))), | |
Term.NewAnonymous(Template( | |
List(), | |
List( | |
Init( | |
Type.Apply(Type.Name("Value"), List(Type.Name("Int"))), | |
Name.Anonymous, | |
List() | |
) | |
), | |
Self(Name.Anonymous, None), | |
List( | |
Defn.Def( | |
List(), | |
Term.Name("value"), | |
List(), | |
List(), | |
Some(Type.Name("Int")), | |
Lit.Int(1) | |
) | |
) | |
)) | |
), | |
Defn.Class( | |
List(), | |
Type.Name("Foo"), | |
List( | |
Type.Param( | |
List(), | |
Type.Name("A"), | |
List(), | |
Type.Bounds(None, None), | |
List(), | |
List() | |
) | |
), | |
Ctor.Primary(List(), Name.Anonymous, List(List())), | |
Template( | |
List(), | |
List(), | |
Self(Name.Anonymous, None), | |
List( | |
Defn.Def( | |
List(), | |
Term.Name("parentheses"), | |
List( | |
Type.Param( | |
List(), | |
Type.Name("AA"), | |
List(), | |
Type.Bounds(Some(Type.Name("A")), None), | |
List(), | |
List() | |
) | |
), | |
List( | |
List(), | |
List( | |
Term.Param( | |
List(Mod.Implicit), | |
Term.Name("s"), | |
Some(Type.Apply( | |
Type.Name("Value"), | |
List(Type.Name("AA")) | |
)), | |
None | |
) | |
) | |
), | |
Some(Type.Name("AA")), | |
Term.Select(Term.Name("s"), Term.Name("value")) | |
), | |
Defn.Def( | |
List(), | |
Term.Name("noParentheses"), | |
List( | |
Type.Param( | |
List(), | |
Type.Name("AA"), | |
List(), | |
Type.Bounds(Some(Type.Name("A")), None), | |
List(), | |
List() | |
) | |
), | |
List( | |
List( | |
Term.Param( | |
List(Mod.Implicit), | |
Term.Name("s"), | |
Some(Type.Apply( | |
Type.Name("Value"), | |
List(Type.Name("AA")) | |
)), | |
None | |
) | |
) | |
), | |
Some(Type.Name("AA")), | |
Term.Select(Term.Name("s"), Term.Name("value")) | |
) | |
) | |
) | |
), | |
Defn.Val( | |
List(Mod.Private(Name.Anonymous)), | |
List(Pat.Var(Term.Name("foo"))), | |
None, | |
Term.New(Init( | |
Type.Apply(Type.Name("Foo"), List(Type.Name("Int"))), | |
Name.Anonymous, | |
List(List()) | |
)) | |
), | |
Term.Apply( | |
Term.Select(Term.Name("foo"), Term.Name("parentheses")), | |
List() | |
), | |
Term.Select(Term.Name("foo"), Term.Name("noParentheses")) | |
) | |
) | |
) | |
) | |
) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment