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

[Import as Member] Error on convenience inits in extensions of CFTypes #4419

Merged
merged 1 commit into from Sep 9, 2016

Conversation

milseman
Copy link
Contributor

What's in this pull request?

Swift does not currently support user-defined factory inits. With
import as member, we're seeing many C functions now imported as
initializers, which gives users the false hope that they can define
their own factory inits as conveinence inits in extensions of CF
types. We issue an explicit error now, rather than crashing later.

Resolved bug number: (SR-)


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

Triggering Swift CI

The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:

Smoke Testing

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

A smoke test on macOS does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library only for macOS. Simulator standard libraries and
    device standard libraries are not built.
  3. lldb is not built.
  4. The test and validation-test targets are run only for macOS. The optimized
    version of these tests are not run.

A smoke test on Linux does the following:

  1. Builds the compiler incrementally.
  2. Builds the standard library incrementally.
  3. lldb is built incrementally.
  4. The swift test and validation-test targets are run. The optimized version of these
    tests are not run.
  5. lldb is tested.

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

Note: Only members of the Apple organization can trigger swift-ci.

Swift does not currently support user-defined factory inits. With
import as member, we're seeing many C functions now imported as
initializers, which gives users the false hope that they can define
their own factory inits as conveinence inits in extensions of CF
types. We issue an explicit error now, rather than crashing later.

@@ -2040,6 +2040,9 @@ ERROR(enumstruct_convenience_init,none,
ERROR(nonclass_convenience_init,none,
"convenience initializer not allowed in non-class type %0",
(Type))
ERROR(cfclass_convenience_init,none,
"convenience initializer not yet supported for extensions of CF Types",
Copy link
Contributor

Choose a reason for hiding this comment

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

"types"

Copy link
Contributor

Choose a reason for hiding this comment

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

Also a plural / singular mismatch? "convenience initializers are not yet supported in extensions of CF types".

@jrose-apple
Copy link
Contributor

Some diagnostic wording comments, but the logic looks good.

@milseman
Copy link
Contributor Author

@swift-ci please test

@@ -2040,6 +2040,9 @@ ERROR(enumstruct_convenience_init,none,
ERROR(nonclass_convenience_init,none,
"convenience initializer not allowed in non-class type %0",
(Type))
ERROR(cfclass_convenience_init,none,
"convenience initializers are not yet supported in extensions of CF types",
Copy link
Member

Choose a reason for hiding this comment

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

Even though we plan on fixing this some day, I think s/yet // is more professional sounding here

@milseman
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Collaborator

Build failed
Jenkins build - Swift Test OS X Platform
Git Commit - 14f6884fa0347010a277baca564dbe9d2fde8428
Test requested by - @milseman

Swift does not currently support user-defined factory inits. With
import as member, we're seeing many C functions now imported as
initializers, which gives users the false hope that they can define
their own factory inits as conveinence inits in extensions of CF
types. We issue an explicit error now, rather than crashing later.
@milseman
Copy link
Contributor Author

@swift-ci please test

@milseman
Copy link
Contributor Author

@shahmishal this passed testing, any idea why I can't merge it?

@shahmishal
Copy link
Member

@milseman smoke test check must pass, I added new feature last night if you trigger "Please test" it will also update smoke test checks.

@milseman
Copy link
Contributor Author

@swift-ci please smoke test

2 similar comments
@milseman
Copy link
Contributor Author

milseman commented Sep 7, 2016

@swift-ci please smoke test

@milseman
Copy link
Contributor Author

milseman commented Sep 9, 2016

@swift-ci please smoke test

@milseman
Copy link
Contributor Author

milseman commented Sep 9, 2016

This has been merged into Swift-3 branch because it passed those tests. It's just waiting on the technicality of smoke tests, but Linux is already broken for other reasons. What is the best way to proceed if this one fails yet again?

@milseman
Copy link
Contributor Author

milseman commented Sep 9, 2016

@swift-ci please smoke test

@milseman
Copy link
Contributor Author

milseman commented Sep 9, 2016

@shahmishal please advise

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.

None yet

5 participants