@@ -621,18 +621,24 @@ class BuilderClosureVisitor
621
621
}
622
622
623
623
Expr *buildSomeExpr (Expr *arg) {
624
+ auto optionalDecl = ctx.getOptionalDecl ();
625
+ auto optionalType = optionalDecl->getDeclaredType ();
626
+
624
627
auto loc = arg->getStartLoc ();
625
628
auto optionalTypeExpr =
626
- TypeExpr::createImplicitHack (loc, ctx. getOptionalType () , ctx);
629
+ TypeExpr::createImplicitHack (loc, optionalType , ctx);
627
630
auto someRef = new (ctx) UnresolvedDotExpr (
628
631
optionalTypeExpr, loc, DeclNameRef (ctx.getIdentifier (" some" )),
629
632
DeclNameLoc (loc), /* implicit=*/ true );
630
633
return CallExpr::createImplicit (ctx, someRef, arg, { });
631
634
}
632
635
633
636
Expr *buildNoneExpr (SourceLoc endLoc) {
637
+ auto optionalDecl = ctx.getOptionalDecl ();
638
+ auto optionalType = optionalDecl->getDeclaredType ();
639
+
634
640
auto optionalTypeExpr =
635
- TypeExpr::createImplicitHack (endLoc, ctx. getOptionalType () , ctx);
641
+ TypeExpr::createImplicitHack (endLoc, optionalType , ctx);
636
642
return new (ctx) UnresolvedDotExpr (
637
643
optionalTypeExpr, endLoc, DeclNameRef (ctx.getIdentifier (" none" )),
638
644
DeclNameLoc (endLoc), /* implicit=*/ true );
0 commit comments