File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -730,16 +730,11 @@ object Parsers {
730
730
def typ (): Tree = {
731
731
val start = in.offset
732
732
val isImplicit = in.token == IMPLICIT
733
- var isImplicitFun = false
734
733
if (isImplicit) in.nextToken()
735
734
def functionRest (params : List [Tree ]): Tree =
736
735
atPos(start, accept(ARROW )) {
737
736
val t = typ()
738
- if (isImplicit) {
739
- isImplicitFun = true
740
- new ImplicitFunction (params, t)
741
- }
742
- else Function (params, t)
737
+ if (isImplicit) new ImplicitFunction (params, t) else Function (params, t)
743
738
}
744
739
val t =
745
740
if (in.token == LPAREN ) {
@@ -776,13 +771,13 @@ object Parsers {
776
771
}
777
772
else infixType()
778
773
779
- if (isImplicit && ! isImplicitFun && in.token != ARROW )
780
- syntaxError(" Types with implicit keyword can only be function types" , Position (start, start + nme.IMPLICITkw .asSimpleName.length))
781
-
782
774
in.token match {
783
775
case ARROW => functionRest(t :: Nil )
784
776
case FORSOME => syntaxError(ExistentialTypesNoLongerSupported ()); t
785
- case _ => t
777
+ case _ =>
778
+ if (isImplicit && ! t.isInstanceOf [ImplicitFunction ])
779
+ syntaxError(" Types with implicit keyword can only be function types" , Position (start, start + nme.IMPLICITkw .asSimpleName.length))
780
+ t
786
781
}
787
782
}
788
783
You can’t perform that action at this time.
0 commit comments