Skip to content

Commit

Permalink
Merge pull request #8059 from CodaFi/initial-value-problem
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-ci committed Mar 14, 2017
2 parents 5c0165f + 1367b0c commit dced34a
Show file tree
Hide file tree
Showing 25 changed files with 31 additions and 32 deletions.
10 changes: 7 additions & 3 deletions lib/Sema/TypeCheckStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1441,10 +1441,14 @@ static void checkDefaultArguments(TypeChecker &tc,
->changeResilienceExpansion(expansion);

// Type-check the initializer, then flag that we did so.
if (!tc.typeCheckExpression(e, initContext,
TypeLoc::withoutLoc(param->getType()),
CTP_DefaultParameter))
bool hadError = tc.typeCheckExpression(e, initContext,
TypeLoc::withoutLoc(param->getType()),
CTP_DefaultParameter);
if (!hadError) {
param->setDefaultValue(e);
} else {
param->setDefaultValue(nullptr);
}

tc.checkInitializerErrorHandling(initContext, e);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
func t(UInt=1 + 1 as?Int){
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{ struct A{
p.init(UInt=1 + 1 as?Int){
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// REQUIRES: asserts
// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
s a){func a(UInt=1 + 1 + 1 as?Int){
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{func b(UInt=1 + 1 + 1 as?Int?){class d a{
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
let x[{{{{{{{{{{{{{{{{{{{{{{{{struct c{func b(UInt=1 + 1 + 1 + 1 + 1 as?Int){{{{{{{{{{{{struct P
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// REQUIRES: asserts
// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
nt){{func t(UInt=1 + 1 + 1 as?Int){{{{{[._{
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{{{{{{{func t(UInt=1 + 1 as?Int){{{{
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{struct A{func b(UInt=1 + 1 + 1 as?Int){{{
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
d}func a(UInt=1 + 1 as?Int){{{{{{{{{{{{func b(UInt=1 + 1 + 1 + 1 as?Int){{{{{{{{{{{{{{(a{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// REQUIRES: asserts
// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{{{func t(UInt=1 + 1 + 1 + 1 as?Int){{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{$0{{{{{{{{{{{{{{{{{{{{{{{{
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// REQUIRES: asserts
// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{struct A{func b(UInt=1 + 1 as?Int){{
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{==a
extension{func c(UInt=1 + 1 + 1 + 1 as?Int){
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
u
func o(UInt=1 + 1 as?Int){r
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{func b(UInt=1 + 1 + 1 + 1 + 1 as?Int){a
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
==1 C:{func b(UInt=1 + 1 + 1 as?Int){a==A(
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
func b(UInt=1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 as?Int){a
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{
struct c{}func t(UInt= 1 + 1 + 1 + 1 as?Int){
{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{
class C{func o(UInt=1 + 1 + 1 + 1 + 1 as?Int){{
{r
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{struct A{func a(UInt=1 + 1 + 1 + 1 as?Int){{
protocol r
protocol A
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
{struct B{func o(UInt=_=1 + 1 + 1 + 1 as?Int){a f{{A
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
struct A{
func a
func o(UInt=1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 as?Int){a f=1 1?{_=(
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
a<
func a
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// REQUIRES: OS=linux-gnu
// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
func o(UInt=_=1 + 1 t){a
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
n
func{(struct A{func b(Int=1 + 1 + 1 as?Int?){a

0 comments on commit dced34a

Please sign in to comment.