@@ -1914,26 +1914,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
1914
1914
.showing(i " desugared fun $tree --> $desugared with pt = $pt" , typr)
1915
1915
}
1916
1916
1917
- /** Check that the PolyFunction doesn't have by-name parameters.
1918
- * Return the unchanged tree if it's valid, or EmptyTree otherwise.
1919
- */
1920
- private def checkPolyTypeTree (tree : untpd.Tree )(using Context ): untpd.Tree =
1921
- val untpd .PolyFunction (tparams : List [untpd.TypeDef ] @ unchecked, fun @ untpd.Function (vparamTypes, res)) = tree : @ unchecked
1922
- var tree1 = tree
1923
- vparamTypes.foreach:
1924
- case t : ByNameTypeTree =>
1925
- report.error(" By-name parameters are not supported in Polymorphic Functions" , t.srcPos)
1926
- tree1 = untpd.EmptyTree
1927
- case _ =>
1928
- tree1
1929
-
1930
1917
def typedPolyFunction (tree : untpd.PolyFunction , pt : Type )(using Context ): Tree =
1931
1918
val tree1 = desugar.normalizePolyFunction(tree)
1932
- checkPolyTypeTree(tree1) match
1933
- case tree2 : untpd.PolyFunction =>
1934
- if (ctx.mode is Mode .Type ) typed(desugar.makePolyFunctionType(tree2), pt)
1935
- else typedPolyFunctionValue(tree2, pt)
1936
- case untpd.EmptyTree => TypeTree (NoType )
1919
+ if (ctx.mode is Mode .Type ) typed(desugar.makePolyFunctionType(tree1), pt)
1920
+ else typedPolyFunctionValue(tree1, pt)
1937
1921
1938
1922
def typedPolyFunctionValue (tree : untpd.PolyFunction , pt : Type )(using Context ): Tree =
1939
1923
val untpd .PolyFunction (tparams : List [untpd.TypeDef ] @ unchecked, fun) = tree : @ unchecked
0 commit comments