We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1d58b64 + 2690241 commit 8743454Copy full SHA for 8743454
compiler/src/dotty/tools/dotc/ast/Desugar.scala
@@ -920,8 +920,9 @@ object desugar {
920
assert(arity <= Definitions.MaxTupleArity)
921
def tupleTypeRef = defn.TupleType(arity)
922
if (arity == 1) ts.head
923
+ else if (arity == 0)
924
+ if (ctx.mode is Mode.Type) TypeTree(defn.UnitType) else unitLiteral
925
else if (ctx.mode is Mode.Type) AppliedTypeTree(ref(tupleTypeRef), ts)
- else if (arity == 0) unitLiteral
926
else Apply(ref(tupleTypeRef.classSymbol.companionModule.termRef), ts)
927
}
928
tests/neg/i5640.scala
@@ -0,0 +1,3 @@
1
+object test {
2
+ val foo = (()) => () // error: not a legal formal parameter
3
+}
0 commit comments