File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
validation-test/Sema/type_checker_crashers_fixed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -809,13 +809,16 @@ Type TypeBase::getWithoutParens() {
809
809
Type TypeBase::replaceCovariantResultType (Type newResultType,
810
810
unsigned uncurryLevel) {
811
811
if (uncurryLevel == 0 ) {
812
- if (auto objectType = getOptionalObjectType ()) {
812
+ bool isLValue = is<LValueType>();
813
+
814
+ auto loadedTy = getWithoutSpecifierType ();
815
+ if (auto objectType = loadedTy->getOptionalObjectType ()) {
813
816
assert (!newResultType->getOptionalObjectType ());
814
- return OptionalType::get (
817
+ newResultType = OptionalType::get (
815
818
objectType->replaceCovariantResultType (newResultType, uncurryLevel));
816
819
}
817
820
818
- return newResultType;
821
+ return isLValue ? LValueType::get (newResultType) : newResultType;
819
822
}
820
823
821
824
// Determine the input and result types of this function.
Original file line number Diff line number Diff line change
1
+ // RUN: not %target-swift-frontend %s -typecheck
2
+
3
+ final class Whatever {
4
+ static var instance : Self !
5
+
6
+ static var shared : Self {
7
+ return instance ?? {
8
+ instance = Self ( )
9
+ return instance
10
+ }
11
+ }
12
+ }
You can’t perform that action at this time.
0 commit comments