File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -2988,6 +2988,14 @@ namespace {
2988
2988
DeclName name (tc.Context , DeclBaseName::createConstructor (),
2989
2989
{ tc.Context .Id_arrayLiteral });
2990
2990
2991
+ // Coerce the array elements to be rvalues, so that other type-checker
2992
+ // code that attempts to peephole the AST doesn't have to re-load the
2993
+ // elements (and break the invariant that lvalue nodes only get their
2994
+ // access kind set once).
2995
+ for (auto &element : expr->getElements ()) {
2996
+ element = cs.coerceToRValue (element);
2997
+ }
2998
+
2991
2999
// Restructure the argument to provide the appropriate labels in the
2992
3000
// tuple.
2993
3001
SmallVector<TupleTypeElt, 4 > typeElements;
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-silgen -verify %s
2
+ // REQUIRES: objc_interop
3
+ import Foundation
4
+
5
+ var x = 1
6
+
7
+ _ = [ x] as [ NSNumber ]
You can’t perform that action at this time.
0 commit comments