Commit Graph

1 Commits

Author SHA1 Message Date
Harlan Haskins
7fd8649d30 [AST] Handle printing default values for tuples of nils
If a var has optional type, e.g.

```
var x: Int?
```

It will be implicitly initialized to `nil`. However, there's a second,
undocumented behavior: tuples of optional type, potentially nested infinitely,
will also be initialized, to tuples of nil.

So this var

```
var w: ((Int?, (), Int?), (Int?, Int?))
```

Will be default-initialized to

```
((nil, (), nil), (nil, nil))
```

We need to handle this inside getDefaultValueStringRepresentation,
otherwise we will crash while emitting partial modules.

Fixes one instance of rdar://51560190
2019-08-06 11:58:50 -07:00