@@ -72,20 +72,20 @@ trait InkuireSupport:
72
72
! s.flags.is(Flags .Override ) &&
73
73
! s.flags.is(Flags .Synthetic )
74
74
75
+ if classDef.symbol.isImplicitClass then // Implicit classes
76
+ classDef.symbol.maybeOwner.declarations
77
+ .filter { methodSymbol =>
78
+ methodSymbol.name == classDef.symbol.name && methodSymbol.flags.is(Flags .Implicit ) && methodSymbol.flags.is(Flags .Method )
79
+ }
80
+ .foreach(handleImplicitConversion(_, variableNames))
81
+
75
82
classDef.symbol.declaredMethods
76
83
.filter(viableSymbol)
77
84
.tap { _.foreach { // Loop for implicit conversions
78
85
case implicitConversion : Symbol if implicitConversion.flags.is(Flags .Implicit )
79
86
&& classDef.symbol.flags.is(Flags .Module )
80
87
&& implicitConversion.owner.fullName == (" scala.Predef$" ) =>
81
- val defdef = implicitConversion.tree.asInstanceOf [DefDef ]
82
- val to = defdef.returnTpt.asInkuire(variableNames)
83
- val from = defdef.paramss.flatMap(_.params).collectFirst {
84
- case v : ValDef => v.tpt.asInkuire(variableNames)
85
- }
86
- (from, to) match
87
- case (Some (from : Inkuire .Type ), to : Inkuire .Type ) => Inkuire .db = Inkuire .db.copy(implicitConversions = Inkuire .db.implicitConversions :+ (from.itid.get -> to))
88
- case _ =>
88
+ handleImplicitConversion(implicitConversion, variableNames)
89
89
case _ =>
90
90
}}
91
91
.tap { _.foreach { // Loop for functions and vals
@@ -150,6 +150,17 @@ trait InkuireSupport:
150
150
}
151
151
}
152
152
153
+ private def handleImplicitConversion (implicitConversion : Symbol , variableNames : Set [String ]) = {
154
+ val defdef = implicitConversion.tree.asInstanceOf [DefDef ]
155
+ val to = defdef.returnTpt.asInkuire(variableNames)
156
+ val from = defdef.paramss.flatMap(_.params).collectFirst {
157
+ case v : ValDef => v.tpt.asInkuire(variableNames)
158
+ }
159
+ (from, to) match
160
+ case (Some (from : Inkuire .Type ), to : Inkuire .Type ) => Inkuire .db = Inkuire .db.copy(implicitConversions = Inkuire .db.implicitConversions :+ (from.itid.get -> to))
161
+ case _ =>
162
+ }
163
+
153
164
private def nameAndOwnerName (classDef : ClassDef , symbol : Symbol ): (String , String ) =
154
165
if classDef.symbol.flags.is(Flags .Module )
155
166
&& (classDef.symbol.companionClass != Symbol .noSymbol || (Seq (" apply" , " unapply" ).contains(symbol.name))) then
@@ -168,6 +179,7 @@ trait InkuireSupport:
168
179
else if sym == defn.EmptyPackageClass then List .empty
169
180
else if sym == defn.RootPackage then List .empty
170
181
else if sym == defn.RootClass then List .empty
182
+ else if sym.normalizedName.contains(" $package" ) then ownerNameChain(sym.owner)
171
183
else ownerNameChain(sym.owner) :+ sym.normalizedName
172
184
173
185
private def paramsForClass (classDef : ClassDef , vars : Set [String ]): Seq [Inkuire .Variance ] =
0 commit comments