File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1896,7 +1896,10 @@ class Namer { typer: Typer =>
18961896 */
18971897 def expectedDefaultArgType =
18981898 val originalTp = defaultParamType
1899- val approxTp = wildApprox(originalTp)
1899+ val approxTp = withMode(Mode .TypevarsMissContext ):
1900+ // assert TypevarsMissContext so that TyperState does not leak into approximation
1901+ // We approximate precisely because we want to unlink the type variable. Test case is i18795.scala.
1902+ wildApprox(originalTp)
19001903 approxTp.stripPoly match
19011904 case atp @ defn.ContextFunctionType (_, resType)
19021905 if ! defn.isNonRefinedFunction(atp) // in this case `resType` is lying, gives us only the non-dependent upper bound
Original file line number Diff line number Diff line change 1+ package example
2+
3+ object Main extends App with Test {
4+ load(" " )()
5+ }
6+
7+ trait Test {
8+
9+ def load [T ](
10+ doLoad : T
11+ )(
12+ description : T => Option [String ] = (x : T ) => None // <--- compile error here
13+ ): Unit = ???
14+
15+ }
You can’t perform that action at this time.
0 commit comments