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 @@ -3015,6 +3015,14 @@ namespace {
3015
3015
DeclName name (tc.Context , DeclBaseName::createConstructor (),
3016
3016
{ tc.Context .Id_arrayLiteral });
3017
3017
3018
+ // Coerce the array elements to be rvalues, so that other type-checker
3019
+ // code that attempts to peephole the AST doesn't have to re-load the
3020
+ // elements (and break the invariant that lvalue nodes only get their
3021
+ // access kind set once).
3022
+ for (auto &element : expr->getElements ()) {
3023
+ element = cs.coerceToRValue (element);
3024
+ }
3025
+
3018
3026
// Restructure the argument to provide the appropriate labels in the
3019
3027
// tuple.
3020
3028
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