Skip to content

Add a test mode to exercise implicit dynamic #23452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ set(profdata_merge_worker

set(TEST_MODES
optimize_none optimize optimize_unchecked optimize_size
optimize_none_with_implicit_dynamic
only_executable only_non_executable
)
set(TEST_SUBSETS
Expand Down
2 changes: 2 additions & 0 deletions test/IRGen/report_dead_method_call.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// RUN: %target-run %t/report_dead_method_call
// REQUIRES: executable_test

// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

private protocol PrivateProto {
func abc()
}
Expand Down
3 changes: 3 additions & 0 deletions test/Interpreter/SDK/mapkit_header_static.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// REQUIRES: objc_interop
// UNSUPPORTED: OS=tvos

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import MapKit

let rect = MKMapRectMake(1.0, 2.0, 3.0, 4.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// REQUIRES: objc_interop
// REQUIRES: executable_test

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import UsingObjCStuff

print("Let's go") // CHECK: Let's go
Expand Down
3 changes: 3 additions & 0 deletions test/Interpreter/SDK/objc_factory_method.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// REQUIRES: executable_test
// REQUIRES: OS=macosx

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import AppKit

let image = NSImage(named: NSImage.Name.trashEmpty)
Expand Down
15 changes: 9 additions & 6 deletions test/Interpreter/SDK/objc_swift3_deprecated_objc_inference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@
// REQUIRES: executable_test
// REQUIRES: objc_interop

// Requires explicit swift-version 4.
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import StdlibUnittest
import Foundation

var DeprecatedObjCInferenceTestSuite = TestSuite("DeprecatedObjCInferenceTestSuite")

class MyClass : NSObject {
// The line numbers of the next two methods are mentioned in the CHECK lines
// below. Please keep them as 26 and 27.
// below. Please keep them as 29 and 30.
func foo() { }
class func bar() { }
}
Expand All @@ -42,15 +45,15 @@ DeprecatedObjCInferenceTestSuite.test("messagingObjCInference") {
// CHECK_CRASH: ---Begin
fputs("---Begin\n", stderr)

// CHECK_WARNINGS: .swift:26:3: implicit Objective-C entrypoint -[a.MyClass foo]
// CHECK_CRASH: .swift:26:3: implicit Objective-C entrypoint -[a.MyClass foo]
// CHECK_WARNINGS: .swift:29:3: implicit Objective-C entrypoint -[a.MyClass foo]
// CHECK_CRASH: .swift:29:3: implicit Objective-C entrypoint -[a.MyClass foo]
x.perform(Selector(fooSel))
// CHECK_WARNINGS-NOT: .swift:26:3: implicit Objective-C entrypoint -[a.MyClass foo]
// CHECK_WARNINGS-NOT: .swift:29:3: implicit Objective-C entrypoint -[a.MyClass foo]
x.perform(Selector(fooSel))

// CHECK_WARNINGS: .swift:27:3: implicit Objective-C entrypoint +[a.MyClass bar]
// CHECK_WARNINGS: .swift:30:3: implicit Objective-C entrypoint +[a.MyClass bar]
type(of: x).perform(Selector(barSel))
// CHECK_WARNINGS-NOT: .swift:27:3: implicit Objective-C entrypoint +[a.MyClass bar]
// CHECK_WARNINGS-NOT: .swift:30:3: implicit Objective-C entrypoint +[a.MyClass bar]
type(of: x).perform(Selector(barSel))

// CHECK_NOTHING-NEXT: ---End
Expand Down
3 changes: 3 additions & 0 deletions test/Interpreter/SDK/object_literals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// REQUIRES: executable_test
// REQUIRES: OS=macosx

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import AppKit
import StdlibUnittest

Expand Down
2 changes: 2 additions & 0 deletions test/Interpreter/dynamicReplacement_property_observer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

// REQUIRES: executable_test

// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

@_private(sourceFile: "dynamic_replacement_property_observer_orig.swift") import TestDidWillSet

#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
Expand Down
3 changes: 3 additions & 0 deletions test/Interpreter/dynamic_cast_optionals_to_nsobject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// REQUIRES: executable_test
// REQUIRES: objc_interop

// Requires swift-version 4.
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import Foundation

// rdar://problem/36477954
Expand Down
3 changes: 3 additions & 0 deletions test/Interpreter/dynamic_replacement_chaining.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

// REQUIRES: executable_test

// This test flips the chaining flag.
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import A

import StdlibUnittest
Expand Down
3 changes: 3 additions & 0 deletions test/Interpreter/enforce_exclusive_access.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
// RUN: %target-run %t/a.out
// REQUIRES: executable_test

// Requires explicit swift-version 4.
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

// Tests for traps at run time when enforcing exclusive access.

import StdlibUnittest
Expand Down
3 changes: 3 additions & 0 deletions test/Interpreter/fractal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
// REQUIRES: executable_test
// REQUIRES: swift_interpreter

// JIT runs in swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import complex

func printDensity(_ d: Int) {
Expand Down
3 changes: 3 additions & 0 deletions test/Interpreter/mandelbrot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
// REQUIRES: executable_test
// REQUIRES: swift_interpreter

// JIT runs in swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import complex

func printDensity(_ d: Int) {
Expand Down
3 changes: 3 additions & 0 deletions test/Interpreter/synthesized_extension_conformances.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// REQUIRES: executable_test
// REQUIRES: objc_interop

// Requires explicit swift-version 4.
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import Foundation

#if FOUNDATION_XCTEST
Expand Down
2 changes: 2 additions & 0 deletions test/Profiler/pgo_foreach.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
// REQUIRES: executable_test
// REQUIRES: OS=macosx

// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

// SIL-LABEL: // pgo_foreach.guessForEach1
// SIL-LABEL: sil @$s11pgo_foreach13guessForEach11xs5Int32VAE_tF : $@convention(thin) (Int32) -> Int32 !function_entry_count(42) {
// IR-LABEL: define swiftcc i32 @$s9pgo_foreach10guessWhiles5Int32VAD1x_tF
Expand Down
2 changes: 2 additions & 0 deletions test/Prototypes/BigInt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// REQUIRES: executable_test
// REQUIRES: CPU=x86_64

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic
import StdlibUnittest
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
import Darwin
Expand Down
8 changes: 8 additions & 0 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,14 @@ if swift_test_mode == 'optimize_none':
# optimize mode for a cpu.
config.available_features.add("swift_test_mode_optimize_none_" + run_cpu)
swift_execution_tests_extra_flags = ''
elif swift_test_mode == 'optimize_none_with_implicit_dynamic':
config.available_features.add("executable_test")
config.limit_to_features.add("executable_test")
config.available_features.add("swift_test_mode_optimize_none_with_implicit_dynamic")
# Add the cpu as a feature so we can selectively disable tests in an
# optimize mode for a cpu.
config.available_features.add("swift_test_mode_optimize_none_" + run_cpu)
swift_execution_tests_extra_flags = '-Xfrontend -enable-implicit-dynamic -Xfrontend -enable-private-imports -Xfrontend -enable-dynamic-replacement-chaining -swift-version 5'
elif swift_test_mode == 'optimize':
config.available_features.add("executable_test")
config.limit_to_features.add("executable_test")
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/AVFoundation_Swift4.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// CoreMedia is not present on watchOS.
// UNSUPPORTED: OS=watchos

// Requires swift-version 5
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import AVFoundation
import StdlibUnittest

Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/ArrayBridge.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
// REQUIRES: executable_test
// REQUIRES: objc_interop

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import Foundation
import ArrayBridgeObjC
import StdlibUnittest
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/Filter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// RUN: %target-run-simple-swift
// REQUIRES: executable_test

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import StdlibUnittest


Expand Down
4 changes: 2 additions & 2 deletions test/stdlib/Inputs/KeyPathMultiFile_b.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ struct A {
}

func A_x_keypath() -> WritableKeyPath<A, Int> {
return \A.x
return \A.x as! WritableKeyPath<A, Int>
}

func A_subscript_0_keypath() -> WritableKeyPath<A, Int> {
return \A.[0]
return \A.[0] as! WritableKeyPath<A, Int>
}
3 changes: 3 additions & 0 deletions test/stdlib/Integers.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

// FIXME: this test runs forever on iOS arm64
// REQUIRES: OS=macosx

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic
%{
word_bits = int(WORD_BITS) / 2
from SwiftIntTypes import all_integer_types
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/Map.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// RUN: %target-run-simple-swift | %FileCheck %s
// REQUIRES: executable_test

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

// Check that the generic parameters are called 'Base' and 'Element'.
protocol TestProtocol1 {}

Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/MapFilterLayerFoldingCompatibilty.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// RUN: %target-build-swift %s -o %t/a.out5 -swift-version 5 && %target-codesign %t/a.out5 && %target-run %t/a.out5
// REQUIRES: executable_test

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import StdlibUnittest

#if swift(>=5)
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/Metal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

// REQUIRES: executable_test

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import StdlibUnittest

import Metal
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/MetalKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

// REQUIRES: executable_test

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import StdlibUnittest

import Metal
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/NSStringAPI+Substring.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

// REQUIRES: objc_interop

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

//
// Tests for the NSString APIs on Substring
//
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/Reflection_objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// REQUIRES: executable_test
// REQUIRES: objc_interop

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

//
// DO NOT add more tests to this file. Add them to test/1_stdlib/Runtime.swift.
//
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/ReverseCompatibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// RUN: %target-build-swift %s -o %t/a.out5 -swift-version 5 && %target-codesign %t/a.out5 && %target-run %t/a.out5
// REQUIRES: executable_test

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import StdlibUnittest

#if swift(>=4.2)
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/RuntimeObjC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// REQUIRES: executable_test
// REQUIRES: objc_interop

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import Swift
import StdlibUnittest

Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/StringCompatibility.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -o %t/a.out4 -swift-version 4 && %target-codesign %t/a.out4 && %target-run %t/a.out4

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

// REQUIRES: executable_test

import StdlibUnittest
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/StringFlatMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

// REQUIRES: executable_test

// Needs swift-version 4.
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import StdlibUnittest


Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/TestData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
// REQUIRES: executable_test
// REQUIRES: objc_interop

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import Foundation
import Dispatch
import ObjectiveC
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/TestIndexSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
// REQUIRES: executable_test
// REQUIRES: objc_interop

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import Foundation

#if FOUNDATION_XCTEST
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/TestMeasurement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
// REQUIRES: executable_test
// REQUIRES: objc_interop

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import Foundation

#if FOUNDATION_XCTEST
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/UnsafePointer.swift.gyb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// RUN: %target-run-simple-swiftgyb
// REQUIRES: executable_test

// Requires swift-version 4
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

import StdlibUnittest


Expand Down
Loading