-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[SR-4102] 'self' used before all stored properties are initialized when trying to pass in the type to method #46685
Comments
The problem is that |
Reopening to fix the diagnostic. :-) |
Tagging as a Starter Bug. While we might eventually do something more complicated, the simple thing right now is to find out where that diagnostic is being emitted and just emit a different one (a new one) if the enclosing context is an enum. |
Comment by David Sweeris (JIRA) Is "instance method '<method name>' called before 'self' is initialized" an ok error message? |
That seems pretty good. Please don't hardcode "instance method"; we have something called DescriptiveDeclKind for that. |
That even seems better for structs, although there I'd want to say "fully initialized". |
Comment by David Sweeris (JIRA) K, I'll change the one for structs as soon as I finish the enum message. Thanks for the DescriptiveDeclKind pointer... I figured there'd be something like that floating around somewhere. |
Comment by David Sweeris (JIRA) Seems like all the related tests are in "swift/test/SILOptimizer/definite_init_diagnostics.swift". Is that right? I mean I get that they're all "definite initialization" errors, but at least to me "SILOptimizer" seems to be an unexpected place to test for them. Also, is there a way to run only the tests in "definite_init_diagnostics.swift"? I haven't actually timed it, but I'm pretty sure "swift/utils/build-script --test" takes a couple hours (and needs to be run twice for every change I make – once to see what fails on the master branch, and again to see if my changes create any new and unexpected failures), and I couldn't get anything else in the "Testing.md" doc to work for me. |
Using a direct lit.py invocation as described in Testing.md ought to work—it's what most of us do. I wouldn't expect rebuilding to take hours if you're just changing a diagnostic and possibly an implementation file, either, though I suggest using |
Environment
Xcode Version 8.2.1 (8C1002)
OSX 10.12.3 (16D32)
Swift 3
Additional Detail from JIRA
md5: 492b655bbeac25797294a982ff63d7bf
Issue Description:
Get the error
when trying to pass in the type into a method.
The text was updated successfully, but these errors were encountered: