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-7022] [SIL] Autogenerated enum/struct equals functions access level mismatch #49570
Comments
Hm, it looks like we set the access at the Decl level, but don't copy over an attribute for it. Maybe SIL printing should set PrintAccess in PrintOptions? |
Comment by Bartosz Polaczyk (JIRA) Indeed! Enabling ((Qualifier != StoreOwnershipQualifier::Unqualified) || !getFunction().hasQualifiedOwnership() && "Unqualified inst in qualified function"), function createStore, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/include/swift/SIL/SILBuilder.h, line 630. Maybe I will try to dive into this issue... |
Comment by Bartosz Polaczyk (JIRA) Mentioned assertion failed because I missed Problem statement: Fix suggestion private enum P {case a} expects private enum P {
case a
@_implements(Equatable, ==(_:_:)) private static func __derived_enum_equals(_ a: P, _ b: P) -> Bool
private var hashValue: Int { get }
} bin/swift -frontend -c -primary-file /Users/bartosz.polaczyk/Desktop/si.sil -target x86_64-apple-darwin17.4.0 -enable-objc-interop -color-diagnostics -module-name si -o /var/folders/3v/2ymlw0cd53q9k8qsr1vg45gh0000gn/T/si-49e136.o -assume-parsing-unqualified-ownership-sil
/Users/bartosz.polaczyk/Desktop/si.sil:9:57: error: method '__derived_enum_equals' must be as accessible as its enclosing type because it matches a requirement in protocol 'Equatable'
@_implements(Equatable, ==(_:_:)) private static func __derived_enum_equals(_ a: P, _ b: P) -> Bool
~~~~~~~ ^
fileprivate
/Users/bartosz.polaczyk/Desktop/si.sil:10:15: error: property 'hashValue' must be as accessible as its enclosing type because it matches a requirement in protocol 'Hashable'
private var hashValue: Int { get }
~~~~~~~ ^
fileprivate
Now I am wondering if we really need to emit implicit AST types and declarations in a SILPrinter? I observed that even for BTW |
Hm, probably yes. It's certainly possible for an inlinable function to rely on an internal-but-exposed-in-ABI type being Codable, and that would lead to it mentioning those methods directly. graydon (JIRA User), @xwu, this also seems like a problem for |
Comment by Graydon Hoare (JIRA) @belkadan I .. am afraid I don't really get what you're saying here (nor do I understand much of the thread leading here). Is there a bug in copyFormalAccess? |
No, I'm worried about |
Comment by Graydon Hoare (JIRA) Hm, is this only a module-boundary thing? I.e. would it be fixed by keeping the symbol internal? It's only there to help with incremental mode (and I think some stdlib uses I don't quite understand). |
Comment by Bartosz Polaczyk (JIRA) I cannot proceed to fix that bug. I can only confirm that build |
Environment
swift-DEVELOPMENT-SNAPSHOT-2018-02-14-a
Additional Detail from JIRA
md5: 52499d2b8e0c4f6f3b72a164fc1cca85
Issue Description:
_derived_enum_equals
/_derived_struct_equals
/hashValue
lack access level of an enum in a type declaration so compiling from a sil file fails.generates internal
static func
am I right that it should generate public static func __derived_struct_equals
Here is an error for compiling from a .sil
The text was updated successfully, but these errors were encountered: