Files
swift-mirror/test/SILAnalysis/DestructorAnalysis.swift
Arnold Schwaighofer 283a6bee39 Fix users of ArraySemantics::getSelf to correctly handle Array.init
Array.init does not have a self argument (it returns the newly created array
@owned). Passes using the ArraySemantic::getSelf() interface must handle it
specially.

rdar://19724033

Swift SVN r25013
2015-02-05 19:31:23 +00:00

23 lines
684 B
Swift

// RUN: %target-swift-frontend -O -emit-sil %s -Xllvm -debug-only=destructor-analysis 2>&1 | FileCheck %s
// This test depends on asserts because we look at debug output.
// REQUIRES: asserts
class Foo {}
var a: [Int] = []
var b: [[Int]] = [[]]
var c: [Foo] = []
var d: [[Foo]] = [[]]
a.append(1)
b.append([1])
c.append(Foo())
d.append([Foo()])
// CHECK-DAG: mayStoreToMemoryOnDestruction is false: Array<Int>
// CHECK-DAG: mayStoreToMemoryOnDestruction is false: Array<Array<Int>>
// CHECK-DAG: mayStoreToMemoryOnDestruction is true: Array<Foo>
// CHECK-DAG: mayStoreToMemoryOnDestruction is true: Array<Array<Foo>>
// CHECK-DAG: mayStoreToMemoryOnDestruction is true: Array<T>