Skip to content
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

Add test for Swift array dynamic cast to NSObject #2874

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

lxbndr
Copy link
Contributor

@lxbndr lxbndr commented Sep 7, 2020

I am getting crash when trying to perform dynamic cast like this:

let anyArray: Any = [TestClass()]
let maybeObject = anyArray as? NSObject
Could not cast value of type 'TestFoundation.TestBridging.(unknown context at $7ff798798298).(unknown context at $7ff7987982a0).TestClass' (00007FF7988CC248) to 'Foundation.NSObject' (00007FFD7253A528). 

While it is possibly a bug in new dynamic casting in compiler, I think it is good to cover it with test already.

@lxbndr
Copy link
Contributor Author

lxbndr commented Sep 7, 2020

cc @compnerd @spevans
Could you please run a CI for this? I am going to add the test as xcfail, but first it would be good to see is it fails on Linux as well. Observing this on Windows.

@MaxDesiatov
Copy link
Contributor

@swift-ci please test

@lxbndr
Copy link
Contributor Author

lxbndr commented Sep 7, 2020

So, it fails on Linux too

@MaxDesiatov
Copy link
Contributor

Has anything changed substantially since the last push? Would you like me to retrigger CI for it?

@lxbndr
Copy link
Contributor Author

lxbndr commented Sep 7, 2020

@MaxDesiatov yes, please, that would be nice. Now it is expected-to-fail, so tests should pass. I would look into the reason of this behavior later.

@MaxDesiatov

This comment has been minimized.

@MaxDesiatov
Copy link
Contributor

@swift-ci please test

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! If there is an SR, would be good to reference it.

@lxbndr
Copy link
Contributor Author

lxbndr commented Sep 8, 2020

I was wrong in test expectations. We should expect the value to be not nil. This doesn't affect the issue itself, as dynamic cast is still crashes.
@compnerd @MaxDesiatov Guys, could you please run CI one more time?

@MaxDesiatov

This comment has been minimized.

1 similar comment
@MaxDesiatov
Copy link
Contributor

@swift-ci please test

@spevans
Copy link
Contributor

spevans commented Sep 9, 2020

@swift-ci test linux

@lxbndr
Copy link
Contributor Author

lxbndr commented Sep 10, 2020

As the fix for this issue is merged, I am going to enable the test

@millenomi
Copy link
Contributor

@swift-ci please test

1 similar comment
@compnerd
Copy link
Member

@swift-ci please test

@compnerd compnerd merged commit dc881a8 into swiftlang:master Sep 14, 2020
@lxbndr lxbndr deleted the test-dynamic-cast branch September 15, 2020 07:26
@lxbndr lxbndr changed the title Add failing test for dynamic cast Add test for Swift array dynamic cast to NSObject Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants