Skip to content

Commit

Permalink
add a few comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SethTisue committed Oct 27, 2022
1 parent 7f9a0a7 commit 8cdf496
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,8 @@ class Definitions {
@tu lazy val MethodHandlesLookupClass: ClassSymbol = requiredClass("java.lang.invoke.MethodHandles.Lookup")
@tu lazy val VarHandleClass: ClassSymbol = requiredClass("java.lang.invoke.VarHandle")

// from the Java language spec: https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.12.3
// Java language spec: https://docs.oracle.com/javase/specs/jls/se11/html/jls-15.html#jls-15.12.3
// Scala 2 spec: https://scala-lang.org/files/archive/spec/2.13/06-expressions.html#signature-polymorphic-methods
def isPolymorphicSignature(sym: Symbol) = sym.is(JavaDefined) && {
val owner = sym.maybeOwner
(owner == MethodHandleClass || owner == VarHandleClass)
Expand Down
4 changes: 4 additions & 0 deletions compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,10 @@ trait Applications extends Compatibility {
else expectedResultType match
case SelectionProto(nme.asInstanceOf_, PolyProto(_, resTp), _, _) => resTp
case _ => defn.ObjectType
// synthesize a method type based on the types at the call site.
// one can imagine the original signature-polymorphic method as
// being infinitely overloaded, with each individual overload only
// being brought into existence as needed
val info = MethodType(proto.typedArgs().map(_.tpe.widen), resultType)
val fun2 = fun1.withType(funRef.symbol.copy(info = info).termRef)
simpleApply(fun2, proto)
Expand Down
2 changes: 1 addition & 1 deletion tasty/src/dotty/tools/tasty/TastyFormat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Standard-Section: "ASTs" TopLevelStat*
IDENT NameRef Type -- Used when term ident’s type is not a TermRef
SELECT possiblySigned_NameRef qual_Term -- qual.name
SELECTin Length possiblySigned_NameRef qual_Term owner_Type -- qual.name, referring to a symbol declared in owner that has the given signature (see note below)
SELECTinPoly Length possiblySigned_NameRef qual_Term owner_Type method_Type -- like SELECTin, but with the method_Type too
SELECTinPoly Length possiblySigned_NameRef qual_Term owner_Type method_Type -- like SELECTin, but with the method_Type too (because signature polymorphic)
QUALTHIS typeIdent_Tree -- id.this, different from THIS in that it contains a qualifier ident with position.
NEW clsType_Term -- new cls
THROW throwableExpr_Term -- throw throwableExpr
Expand Down

0 comments on commit 8cdf496

Please sign in to comment.