-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support for Type[length] #52
Comments
This has now been declared “an unofficial hidden feature of 1.1”, so |
Moving to 1.2; if I added it now, I would just have to update it later for consistency with the spec anyways. |
Alright, these have been added to the spec as TupleType: "[" TypeList "]" | PrimaryType "[" DecimalLiteral "]" How do we model them? My best idea currently would be to turn |
A three class solution sounds right to me. |
in preparation for #52. Mostly done with the following two commands: find source -name TupleType.ceylon \ -execdir git mv {} ListTupleType.ceylon \; find source -name '*.ceylon' \ -exec grep -q TupleType {} \; \ -exec sed -i 's/TupleType/ListTupleType/g' {} \; \ -exec git add {} + then manual fixup.
I implemented exactly what I proposed in the above comment, since I haven’t been able to think of anything better (neither layout nor name) in the meantime. Done. |
Fuck me, I already did this half a year ago in c4329c1 without mentioning this issue. So now I have two implementations of this and need to decide which to keep. |
So we currently have two implementations of this:
Which one should we keep? 1 is closer to the RedHat AST, while 2 is slightly closer to the spec. I think I lean slightly towards 2. Any other opinions? |
What’s really mysterious, by the way, is this: both implementations have tests, and all tests currently pass. I don’t understand how this is possible, since both versions should erase to the same RedHat AST – and consequently, it shouldn’t be possible to distinguish between them, and both versions should be converted back to the same version (I would expect 2 due to this). I’ll definitely have to look into this too. |
I'd lean towards 2, I think, since it is indeed a Oh, wait, no. I change my vote. It seems |
I guess that from the viewpoint that |
Found out why the tests work: I’ll add those, check that the tests fail as they should, then remove solution 2. |
The parse and compile functions for SimpleType, PrimaryType, MainType, and UnionableType were missing, as well as tests for all of them plus Type. Most likely a relic from the time before all of this infrastructure was being auto-generated by source-gen. Noticed in #52 and #100; fixes #100. Note that tests currently don’t pass; this is expected since we have two implementations of #52 right now, so the backwards conversion for one of them must fail. This will be resolved in a separate commit which will remove one of the implementations.
Reopening again because there’s one last open question. Per spec, only decimal integer literals are allowed, not binary or hex ones: TupleType: "[" TypeList "]" | PrimaryType "[" DecimalLiteral "]" I enforced this in implementation 2 (here), but not in implementation 1. Should I add it to implementation 1? It depends on whether this is considered a syntax error or a different error. It looks like a syntax error in the spec, but the compiler grammar accepts any integer literal, and instead of a syntax error you get an “error: must be a positive decimal integer”, probably from I could live with both; probably leaning slightly towards not adding the check (but documenting that). |
Not checking. |
We need to support ceylon/ceylon-spec#1041.
I’ll probably wait until it’s properly specified though.
The text was updated successfully, but these errors were encountered: