@@ -1018,22 +1018,27 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne
1018
1018
typeTerms(tup :: Nil , false , Nil )
1019
1019
case Tup (fs) =>
1020
1020
TupleType (fs.mapConserve { case e @ (n, f @ Fld (flags, t)) =>
1021
- n match {
1022
- case S (v) if ctx.inPattern =>
1023
- (n, Fld (flags,
1024
- // Asc(v, t.toTypeRaise).withLoc(v.toLoc.fold(t.toLoc)(_ ++ t.toLoc |> some))))
1025
- Asc (v, Union (t.toTypeRaise, Literal (UnitLit (true )))).withLoc(v.toLoc.fold(t.toLoc)(_ ++ t.toLoc |> some))))
1026
- case N if flags.opt =>
1027
- t match {
1028
- case v : Var if ctx.inPattern =>
1029
- (n, Fld (flags,
1030
- Asc (v, Union (TypeVar (R (" " ), N ), Literal (UnitLit (true )))).withLoc(v.toLoc.fold(t.toLoc)(_ ++ t.toLoc |> some))))
1031
- case _ =>
1032
- // if ctx.inPattern // TODO[optional-fields]
1033
- err(" Error here" , f.toLoc) // TODO[optional-fields]
1034
- e
1021
+ {
1022
+ val res = n match {
1023
+ case S (v) if ctx.inPattern =>
1024
+ (n, Fld (flags,
1025
+ Asc (v, t.toTypeRaise).withLoc(v.toLoc.fold(t.toLoc)(_ ++ t.toLoc |> some))))
1026
+ case N if flags.opt => {
1027
+ val res = t match {
1028
+ case v : Var if ctx.inPattern =>
1029
+ (n, Fld (flags,
1030
+ Asc (v, Union (TypeVar (R (" " ), N ), Literal (UnitLit (true )))).withLoc(v.toLoc.fold(t.toLoc)(_ ++ t.toLoc |> some))))
1031
+ case _ =>
1032
+ // if ctx.inPattern // TODO[optional-fields]
1033
+ err(" Error here" , f.toLoc) // TODO[optional-fields]
1034
+ e
1035
+ }
1036
+ res
1035
1037
}
1036
- case _ => e
1038
+ case _ => e
1039
+ }
1040
+ println(s " dbg [Typer.scala]: $res opt: ${flags.opt}" )
1041
+ res
1037
1042
}
1038
1043
}.map { case (n, Fld (FldFlags (mut, spec, opt, getter), t)) =>
1039
1044
if (getter)
0 commit comments