Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,8 @@ object desugar {
def makePolyFunction(targs: List[Tree], body: Tree): Tree = body match {
case Parens(body1) =>
makePolyFunction(targs, body1)
case Block(Nil, body1) =>
makePolyFunction(targs, body1)
case Function(vargs, res) =>
assert(targs.nonEmpty)
// TODO: Figure out if we need a `PolyFunctionWithMods` instead.
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,7 @@ object Parsers {

private def isFunction(tree: Tree): Boolean = tree match {
case Parens(tree1) => isFunction(tree1)
case Block(Nil, tree1) => isFunction(tree1)
case _: Function => true
case _ => false
}
Expand Down
2 changes: 2 additions & 0 deletions tests/run/polymorphic-functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,6 @@ object Test extends App {
// Parens handling
val tt1: [T] => (T => T) = [T] => (x: T) => x
val tt2: [T] => T => T = [T] => ((x: T) => x)
val tt3: [T] => T => T = [T] => { (x: T) => x }
val tt4: [T] => T => T = [T] => (x: T) => { x }
}