Skip to content

Commit 235b07c

Browse files
committed
type ahead symbols from the sourcepath to add defTrees
1 parent 641a8bb commit 235b07c

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -717,11 +717,17 @@ private class ExtractAPICollector(using Context) extends ThunkHolder {
717717
val sym = ref.symbol
718718
if sym.is(Inline, butNot = Param) && !seenInlines.contains(sym) then
719719
seenInlines += sym // dont re-enter hashing this ref
720-
sym.defTree match
721-
case defTree: ValOrDefDef =>
722-
h = inlineReferenceHash(sym, defTree.rhs, h)
723-
case _ =>
724-
h = err(i"inline method reference `${ref.name}`", ref.name, ref, h)
720+
if sym.is(Method) then
721+
Inliner.bodyToInline(sym) match // force typechecking of body if from source
722+
case EmptyTree =>
723+
h = err("inline method reference", ref, p, h)
724+
case rhs =>
725+
h = inlineReferenceHash(sym, rhs, h)
726+
else
727+
// inline value - its rhs should match its type
728+
// no extra info is gained from hashing the rhs
729+
h = MurmurHash3.mix(h, InlineValHash)
730+
h = inlineReferenceHash(sym, EmptyTree, h)
725731
case _ =>
726732

727733
// FIXME: If `p` is a tree we should probably take its type into account

compiler/src/dotty/tools/dotc/sbt/package.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ inline val TermNameHash = 1987 // 300th prime
99
inline val TypeNameHash = 1993 // 301st prime
1010
inline val EmptyParamHash = 1997 // 302nd prime
1111
inline val InlineParamHash = 1999 // 303rd prime
12+
inline val InlineValHash = 2003 // 304th prime
1213

1314
extension (sym: Symbol)
1415

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ trait Implicits:
980980
trace(s"search implicit ${pt.show}, arg = ${argument.show}: ${argument.tpe.show}", implicits, show = true) {
981981
record("inferImplicit")
982982
assert(ctx.phase.allowsImplicitSearch,
983-
if (argument.isEmpty) i"missing implicit parameter of type $pt after typer"
983+
if (argument.isEmpty) i"missing implicit parameter of type $pt after typer at phase ${ctx.phase.phaseName}"
984984
else i"type error: ${argument.tpe} does not conform to $pt${err.whyNoMatchStr(argument.tpe, pt)}")
985985

986986
if pt.unusableForInference

library/src/scala/compiletime/package.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,3 @@ def byName[T](x: => T): T = x
188188
*/
189189
extension [T](x: T)
190190
transparent inline def asMatchable: x.type & Matchable = x.asInstanceOf[x.type & Matchable]
191-

0 commit comments

Comments
 (0)