Files
swift-mirror/test/SILOptimizer/exclusivity_static_diagnostics_objc.swift
Devin Coughlin cef3139d03 [Exclusivity] Treat warning violations with reabstraction thunks as errors
In Swift 4.1 we fixed a false negative and started looking through
reabstraction thunks to statically find exclusivity violations. To lessen
source impact, we treated these violations as warnings. This commit upgrades
those warnings to errors.

rdar://problem/34669400
2018-04-12 21:38:48 -07:00

19 lines
647 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/optional_closure_bridging.h -enforce-exclusivity=checked -swift-version 4 -emit-sil -primary-file %s -o /dev/null -verify
// REQUIRES: objc_interop
import Foundation
class SomeClass {
@objc
func testCallNoEscapeBlockDirectly(_ c: @convention(block) () -> ()) {
c()
}
}
func testOptionalImport() {
var x = 0
// expected-error@+2{{overlapping accesses to 'x', but modification requires exclusive access; consider copying to a local variable}}
// expected-note@+1{{conflicting access is here}}
SomeObjCInterface.perform(&x) { x += 1 }
}