Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIssue #10605 generate unions from Typdefs inner type #12397
Conversation
highfive
commented
Jul 11, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jul 11, 2016
|
Reviewed 3 of 4 files at r1. components/script/dom/testbinding.rs, line 573 [r1] (raw file):
nit: No space before Comments from Reviewable |
|
@Scorpil Do you use linux? The previous PR stalled after there was a bizarre reproducible build problem only on ubuntu. |
|
@jdm I'm on mac, but trying to reproduce it in virtualbox. As you can see, that problem is still there, so this PR is still WIP. |
|
I can try to reproduce, though I'm not on Ubuntu. |
|
|
|
Ok, so I was able to reproduce it consistently. I'm not an expert in how WebIDL.py works, so to fix it I did the obvious thing (#12418), and with that and this patch |
|
@emilio, should i leave this ticket to you? We're doing same stuff in parallel now. |
|
@Scorpil: Feel free to investigate, I'm not going to be able to dedicate it a lot of time to be fair. |
|
@emilio ok, let me know if you have something. |
|
I basically know what's happening, what I don't know is how to solve it. So the reason we have our own On Linux, if you find a So I see two solutions:
Does that make sense? |
|
Doing nothing is not an option. I don't think typing something like |
|
@KiChjang: What about generating a |
|
I believe that was tried before, but I think the problem was that none of the enum variants can be referenced that way, i.e. pub use AOrBOrCOrD as AOrFoo;
// Does not work
let bar = AOrFoo::B(...); |
|
Are you sure about that? I know it doesn't work with |
|
@emilio , @KiChjang well, we can fix the issue with this easy fix: Scorpil@49cadcd It's not ideal, as it implicitly enforces file naming convention (if you rename TestBindings.rs to TestBindingsZ.rs it will break again), but it does the job now and will keep feature cross-platform until somebody implements proper file dependency logic. Here's travis build btw: https://travis-ci.org/Scorpil/servo/jobs/144395789 |
|
FWIW, distinct webidl files exist only as source code organization. Conceptually, they're all one big file where order does not matter. |
|
@Ms2ger so we need some kind of "dynamic dispatch" here? I'll see what i can come up with. |
|
r? @Ms2ger |
|
The problem with sorting the list IMO is that even more unexpected behavior may appear. For example you can use a union with |
|
Hadn't seen the last patch actually, but if you change the webidl parser, can you ensure:
That would make the attempt clearer. |
|
It wasn't related to fileorder after all. Well, maybe it was, but that was not the root of the problem. The bug was in 'complete' method for UnionType that:
|
|
@emilio just tried test-webidl - passed. |
|
Travis is failing:
|
|
@KiChjang ugh, just saw it too... This is one strange bug. I'm going to fix it, again, over the next couple of days. You should probably remove awaiting review flair for now. |
|
@Scorpil fwiw, is it again a linux-only bug? |
|
@emilio yep. |
|
|
|
@Scorpil Any updates on this? |
|
You might try running |
|
@Scorpil Are you planning on finishing this? |
|
@KiChjang I'd like to, but looks like I don't have enough experience with servo to get to the root of this in my free time. Sorry, I'll try to help servo on some other ticket. |
|
I've rebased this in my branch, and I found out that some new parts of the code was never run at all. |
| @@ -3860,6 +3878,14 @@ def get_match(name): | |||
| else: | |||
| arrayObject = None | |||
|
|
|||
| typedefMemberTypes = filter(lambda t: isinstance(t, IDLTypedefType), memberTypes) | |||
| if len(typedefMemberTypes) > 0: | |||
This comment has been minimized.
This comment has been minimized.
KiChjang
Sep 6, 2016
Member
For example. typedefMemberTypes was always null, even if I change isinstance(t, IDLTypedefType) to t.isTypedef(), causing the if len(typedefMemberTypes) > 0: body to never be run.
| for memberType in t.memberTypes: | ||
| if isinstance(memberType, IDLTypedefType): | ||
| return True | ||
| return False |
This comment has been minimized.
This comment has been minimized.
KiChjang
Sep 6, 2016
Member
This function here is pointless because none of the types passed in ever reaches the true branch condition.
| @@ -3758,6 +3773,9 @@ def getUnionTypeTemplateVars(type, descriptorProvider): | |||
| elif type.isPrimitive(): | |||
| name = type.name | |||
| typeName = builtinNames[type.tag()] | |||
| elif isinstance(type, IDLTypedefType): | |||
| name = type.name | |||
| typeName = type.name | |||
This comment has been minimized.
This comment has been minimized.
KiChjang
Sep 6, 2016
•
Member
This branch was also never ran. None of the types passed in was ever an IDLTypedef or IDLTypedefType.
|
As it currently stands right now, the code in these commits do not work as intended, and as such this isn't valuable in keeping open. |
Scorpil commentedJul 11, 2016
•
edited by larsbergstrom
#11203 follow-up, rebased to current master.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is