Closed
Description
Compiler version
3.3.1
Minimized code
package simple_trees
class Function {
def contextFunctionWildcard: ? ?=> String = ???
}
Output
Decoded TASTy Trees:
0: PACKAGE(118)
2: TERMREFpkg 1 [simple_trees]
4: TYPEDEF(114) 2 [Function]
7: TEMPLATE(93)
9: APPLY(10)
11: SELECTin(8) 9 [<init>[Signed Signature(List(),java.lang.Object) @<init>]]
14: NEW
15: TYPEREF 7 [Object]
17: TERMREFpkg 6 [java[Qualified . lang]]
19: SHAREDtype 15
21: DEFDEF(7) 3 [<init>]
24: EMPTYCLAUSE
25: TYPEREF 10 [Unit]
27: TERMREFpkg 11 [scala]
29: STABLE
30: DEFDEF(70) 12 [contextFunctionWildcard]
33: APPLIEDtpt(22)
35: TYPEREF 13 [ContextFunction1]
37: SHAREDtype 27
39: TYPEBOUNDStpt(8)
41: TYPEREF 14 [Nothing]
43: SHAREDtype 27
45: TYPEREF 15 [Any]
47: SHAREDtype 27
49: IDENTtpt 16 [String]
51: TYPEREF 16 [String]
53: TERMREF 17 [Predef]
55: SHAREDtype 27
57: BLOCK(25)
59: LAMBDA(2)
61: TERMREFdirect 63
63: DEFDEF(19) 18 [$anonfun]
66: PARAM(8) 20 [[Unique evidence$ 1]]
69: TYPEBOUNDS(4)
71: SHAREDtype 41
73: SHAREDtype 45
75: GIVEN
76: SHAREDtype 51
78: TERMREF 21 [???]
80: SHAREDtype 53
82: SYNTHETIC
83: ARTIFACT
84: ANNOTATION(16)
86: TYPEREF 22 [ContextResultCount]
88: TERMREFpkg 26 [scala[Qualified . annotation][Qualified . internal]]
90: APPLY(10)
92: SELECTin(6) 30 [<init>[Signed Signature(List(scala.Int),scala.annotation.internal.ContextResultCount) @<init>]]
95: NEW
96: SHAREDtype 86
98: SHAREDtype 86
100: INTconst 1
102: ANNOTATION(16)
104: TYPEREF 31 [SourceFile]
106: SHAREDtype 88
108: APPLY(10)
110: SELECTin(6) 34 [<init>[Signed Signature(List(java.lang.String),scala.annotation.internal.SourceFile) @<init>]]
113: NEW
114: SHAREDtype 104
116: SHAREDtype 104
118: STRINGconst 35 [test-sources/src/main/scala/simple_trees/Function.scala]
120:
Note in particular the DEFDEF
starting at address 63:
63: DEFDEF(19) 18 [$anonfun]
66: PARAM(8) 20 [[Unique evidence$ 1]]
69: TYPEBOUNDS(4)
71: SHAREDtype 41
73: SHAREDtype 45
75: GIVEN
76: SHAREDtype 51
78: TERMREF 21 [???]
80: SHAREDtype 53
82: SYNTHETIC
83: ARTIFACT
The PARAM
at address 66 with name evidence$1
has a TYPEBOUNDS
as its info
. This makes no sense: term symbols cannot have a TYPEBOUNDS
as their info.
Alternative view: with -Xprint:typer
, we get:
def contextFunctionWildcard: (?) ?=> String =
{
def $anonfun(using evidence$1: ): String = ???
closure($anonfun)
}
which also shows that the evidence$1
has an "empty" type. It's actually how the type printer "prints" a TypeBounds
of >: Nothing <: Any
.
Expectation
The type should be Nothing
instead, or in general, the lower bound of the wildcard.