Skip to content

Test: Improve TBDGen tests for @_specialize and @derivative(of:) attrs #61686

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
merged 1 commit into from
Oct 24, 2022
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
51 changes: 51 additions & 0 deletions test/TBD/specialize_attr.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// REQUIRES: VENDOR=apple

// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing %s
// RUN: %target-swift-frontend -enable-library-evolution -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing %s
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing %s -enable-testing
// RUN: %target-swift-frontend -enable-library-evolution -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing %s -enable-testing

// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing -O %s
// RUN: %target-swift-frontend -enable-library-evolution -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing -O %s
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing %s -enable-testing -O
// RUN: %target-swift-frontend -enable-library-evolution -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing %s -enable-testing -O

@_specialize(exported: false, where T == Int)
@_specialize(exported: true, where T == Float)
public func foo<T>(_ x : T) -> T { return x }

@_specialize(exported: false, where T == Int)
@_specialize(exported: true, where T == Float)
internal func fooInternal<T>(_ x : T) -> T { return x }

@_specialize(exported: false, where T == Int)
@_specialize(exported: true, where T == Float)
private func fooPrivate<T>(_ x : T) -> T { return x }

public struct S {
@_specialize(exported: false, where T == Int)
@_specialize(exported: true, where T == Float)
public func foo<T>(_ x : T) -> T { return x }

@_specialize(exported: false, where T == Int)
@_specialize(exported: true, where T == Float)
internal func fooInternal<T>(_ x : T) -> T { return x }

@_specialize(exported: false, where T == Int)
@_specialize(exported: true, where T == Float)
private func fooPrivate<T>(_ x : T) -> T { return x }
}

public class C {
@_specialize(exported: false, where T == Int)
@_specialize(exported: true, where T == Float)
public func foo<T>(_ x : T) -> T { return x }

@_specialize(exported: false, where T == Int)
@_specialize(exported: true, where T == Float)
internal func fooInternal<T>(_ x : T) -> T { return x }

@_specialize(exported: false, where T == Int)
@_specialize(exported: true, where T == Float)
private func fooPrivate<T>(_ x : T) -> T { return x }
}
7 changes: 0 additions & 7 deletions test/TBD/specialize_verify.swift

This file was deleted.