Skip to content

Commit b1d412e

Browse files
committed
---
yaml --- r: 348583 b: refs/heads/master c: d93e6f4 h: refs/heads/master i: 348581: d1cbc14 348579: 4ac5bd4 348575: cee0d57
1 parent 201afc1 commit b1d412e

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: cca882b73df2d1a12dbacff8939e81a03689494d
2+
refs/heads/master: d93e6f46680f18c4f33defa174fa1b07b3281d65
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/Sema/TypeCheckConstraints.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,7 +2633,7 @@ bool TypeChecker::typeCheckBinding(Pattern *&pattern, Expr *&initializer,
26332633
emptyLocator);
26342634
return propertyType;
26352635
}
2636-
2636+
26372637
// Otherwise, compute the wrapped value type directly.
26382638
return computeWrappedValueType(wrappedVar, initType);
26392639
}
@@ -2654,10 +2654,10 @@ bool TypeChecker::typeCheckBinding(Pattern *&pattern, Expr *&initializer,
26542654
// is the initialization of the property wrapper instance.
26552655
initType = cs.getType(expr);
26562656

2657-
// Add a conversion constraint between the pattern type and the
2657+
// Add an equal constraint between the pattern type and the
26582658
// property wrapper's "value" type.
2659-
cs.addConstraint(ConstraintKind::Conversion, patternType,
2660-
getPatternInitType(&cs), Locator, /*isFavored*/true);
2659+
cs.addConstraint(ConstraintKind::Equal, patternType,
2660+
getPatternInitType(&cs), Locator, /*isFavored*/ true);
26612661
} else {
26622662
// The initializer type is the type of the pattern.
26632663
initType = patternType;

trunk/test/decl/var/property_wrappers.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,3 +1683,17 @@ final class SR_11478_C2 {
16831683
@SR_11478_W class var bool2: Bool = true // expected-error {{class stored properties not supported in classes; did you mean 'static'?}}
16841684
@SR_11478_W class final var bool3: Bool = true // expected-error {{class stored properties not supported in classes; did you mean 'static'?}}
16851685
}
1686+
1687+
// SR-11381
1688+
1689+
@propertyWrapper
1690+
struct SR_11381_W<T> {
1691+
init(wrappedValue: T) {}
1692+
var wrappedValue: T {
1693+
fatalError()
1694+
}
1695+
}
1696+
1697+
struct SR_11381_S {
1698+
@SR_11381_W var foo: Int = nil // expected-error {{'nil' is not compatible with expected argument type 'Int'}}
1699+
}

0 commit comments

Comments
 (0)