diff --git a/lib/SILGen/SILGenExpr.cpp b/lib/SILGen/SILGenExpr.cpp index 1700891281a2f..2cc12d0c46caf 100644 --- a/lib/SILGen/SILGenExpr.cpp +++ b/lib/SILGen/SILGenExpr.cpp @@ -4283,9 +4283,6 @@ namespace { // If the destination is a tuple, recursively destructure. void visitTupleExpr(TupleExpr *E) { - auto *TTy = E->getType()->castTo(); - assert(TTy->hasLValueType() || TTy->isVoid()); - (void)TTy; for (auto &elt : E->getElements()) { visit(elt); } @@ -4398,7 +4395,6 @@ static void emitSimpleAssignment(SILGenFunction &SGF, SILLocation loc, // Handle tuple destinations by destructuring them if present. CanType destType = dest->getType()->getCanonicalType(); - assert(!destType->isMaterializable() || destType->isVoid()); // But avoid this in the common case. if (!isa(destType)) { diff --git a/test/SILGen/assignment.swift b/test/SILGen/assignment.swift index efd002938a612..876515654bf5c 100644 --- a/test/SILGen/assignment.swift +++ b/test/SILGen/assignment.swift @@ -49,3 +49,12 @@ func copyRightToLeft(p: inout P) { // CHECK: end_access [[WRITE]] : $*P p.left = p.right } + +// SR-5919 +func stupidGames() -> ((), ()) { + return ((), ()) +} + +func assignToNestedVoid() { + let _: ((), ()) = stupidGames() +} \ No newline at end of file diff --git a/test/SILGen/default_arguments.swift b/test/SILGen/default_arguments.swift index a795fa0e7e0d4..48bfaabe90c26 100644 --- a/test/SILGen/default_arguments.swift +++ b/test/SILGen/default_arguments.swift @@ -367,3 +367,19 @@ func callThem() throws { defaultEscaping() autoclosureDefaultEscaping() } + +func tupleDefaultArg(x: (Int, Int) = (1, 2)) {} + +// CHECK-LABEL: sil hidden @$s17default_arguments19callTupleDefaultArgyyF : $@convention(thin) () -> () +// CHECK: function_ref @$s17default_arguments15tupleDefaultArg1xySi_Sit_tFfA_ : $@convention(thin) () -> (Int, Int) +// CHECK: function_ref @$s17default_arguments15tupleDefaultArg1xySi_Sit_tF : $@convention(thin) (Int, Int) -> () +// CHECK: return +func callTupleDefaultArg() { + tupleDefaultArg() +} + +// FIXME: Should this be banned? +func stupidGames(x: Int = 3) -> Int { + return x +} +stupidGames(x:)() \ No newline at end of file