-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SE-0155][WIP] Normalize Enum Case Representation #12397
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
Conversation
lib/SIL/SILVerifier.cpp
Outdated
// indirect case elet(locals: [(String, Expr)], body: Expr) | ||
// } | ||
// | ||
// Expr.elet(locals: body:)([], someExpr) |
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.
@gottesmm Any thoughts here?
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.
What is "an uncurried EnumInst payload sans argument labels"?
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.e., can you elaborate?
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.
See the example in the comment. The old check does strict type equality (labels included) rather than element-by-element equality (labels excluded)
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.
Can you show me what the SIL looks like?
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.
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 can't really say anything about SIL verification without seeing the SIL).
If you had said that sometimes you pass the payload boxed to the enum, I would have understood you immediately.
I would say the check should be that it is either the payload type or a boxed payload type.
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.e. we had a language issue = p).
ERROR(enum_element_empty_arglist,none, | ||
"empty enum element argument list must be spelled with 'Void'", ()) | ||
WARNING(enum_element_empty_arglist_swift3,none, | ||
"empty enum element argument list must be spelled with 'Void'", ()) |
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.
This needs phrasing as a warning
@@ -1529,7 +1529,7 @@ func genfoo<T1, T2>(x ix: T1, y iy: T2) where T1 : Prot, T2 : cake.C1, T1.Elemen | |||
key.entities: [ | |||
{ | |||
key.kind: source.lang.swift.decl.enumelement, | |||
key.name: "case1", | |||
key.name: "case1()", |
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.
@benlangmuir Any idea what is causing SourceKit to serialize a null parameter list like this?
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.
SourceKit is just calling ValueDecl::getFullName. This test is loading the decl from a Swift module though, so maybe check that?
fd94ef2
to
59447ec
Compare
3180456
to
e1e61e6
Compare
@slavapestov I'm going to try to make everything go through |
e1e61e6
to
f3db926
Compare
@swift-ci please smoke test |
@CodaFi Any progress to this PR? I'm really looking forward to this feature. :) |
f3db926
to
85ce4fc
Compare
Got a pile of test failures with this patch. Turns out changing SILGen changes SILGen
|
I've rebased this PR last weekend: https://github.com/dduan/swift/tree/the-pitter-pattern-of-tiny-feet |
85ce4fc
to
b0e9362
Compare
In theory this passes the tests now @swift-ci please smoke test |
This models, but does not plumb through, default arguments.
b0e9362
to
2373191
Compare
@slavapestov I think a combination of my removing the
|
Closed for #15418 |
SE-0155 Requirements:
case Foo()
, rewrite tocase Foo(Void)
A number of cleanups fell out of this patch:
EnumElementDecl
s owning a parameter list simplifies both serialization and AST printingEnumElementDecl
s as owning a parameter list instead of a tuple@escaping
and actually participate in semantic checksSome open questions:
EnumInst
s interact