-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Pull over fix from 8e7766b and apply to strstr, sin, an… #66896
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
067abeb
[cxx-interop] Pull over fix from 8e7766b and apply to strstr, sin, an…
zoecarver 26e3056
[cxx-interop] Fix ambiguous 'exit' (same solution as above).
zoecarver f07a9ff
[cxx-interop] check file and directory, not or.
zoecarver 42bc167
[cxx-interop] Re-work control flow when checking for duplicate functi…
zoecarver 744783a
[cxx-interop][nfc] remove `print-swiftconcurrencyshims-interface.swif…
zoecarver 173329e
[cxx-interop] only ban strstr, sin, cos, and exit on darwin where the…
zoecarver 50ce843
[cxx-interop] Don't import `exit` from `Darwin` module, use the one f…
zoecarver 6233a65
[cxx-interop][nfc] Disable test for div.
zoecarver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,19 +5,17 @@ | |
import CxxStdlib | ||
|
||
func test() { | ||
let x: Float = 1.0 | ||
let x: Double = 1.0 | ||
let y: Double = 2.0 | ||
|
||
// Note: we dispatch `pow(Float,Double)` | ||
// to ensure we don't pick up the | ||
// C++ stdlib `pow` function template. | ||
// The `pow` function is still reexported | ||
// from Darwin via CxxStdlib, so there are | ||
// matching overloads that can be found still. | ||
// Note: the error is different on Glibc instead | ||
// of Darwin, so do not check the exact error. | ||
let _ = CxxStdlib.pow(x, y) // expected-error {{}} | ||
let _ = pow(x, y) | ||
|
||
let _ = CxxStdlib.abs(x) // expected-error {{module 'CxxStdlib' has no member named 'abs'}} | ||
let _ = CxxStdlib.div(x) // expected-error {{module 'CxxStdlib' has no member named 'div'}} | ||
let _ = abs(x) | ||
// https://github.com/apple/swift/issues/67006 | ||
// let _ = div(42, 2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfect example of why we should test the positive case: div wasn't available on linux even before this patch because it's in |
||
let _ = sin(x) | ||
let _ = cos(x) | ||
let _ = strstr("a", "aaa") | ||
|
||
exit(0) | ||
} |
10 changes: 0 additions & 10 deletions
10
test/Interop/Cxx/stdlib/print-swiftconcurrencyshims-interface.swift
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library) | ||
// | ||
// REQUIRES: executable_test | ||
// REQUIRES: concurrency | ||
// REQUIRES: libdispatch | ||
// REQUIRES: concurrency_runtime | ||
|
||
import StdlibUnittest | ||
|
||
import CxxStdlib | ||
import Cxx | ||
|
||
import _Concurrency | ||
import Dispatch | ||
|
||
@main struct Main { | ||
static func main() async { | ||
var ConcurrencyTestSuite = TestSuite("Concurrency") | ||
|
||
ConcurrencyTestSuite.test("Task.sleep") { | ||
let start = DispatchTime.now() | ||
await Task.sleep(100_000_000) | ||
let stop = DispatchTime.now() | ||
expectTrue(stop >= (start + .nanoseconds(100_000_000))) | ||
} | ||
|
||
ConcurrencyTestSuite.test("Task.sleep (non-blocking)") { | ||
let task = detach { | ||
std.string("Hello, Swift!") | ||
} | ||
|
||
await Task.sleep(100_000_000) | ||
expectEqual(await task.get(), "Hello, Swift!") | ||
} | ||
|
||
await runAllTestsAsync() | ||
} | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was getting errors like this:
So I figured we could just test the positive case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also testing the positive case seems more direct in terms of making sure the thing we want to work works. It also is a bit less fragile and more portable.