ceylon / ceylon.ast

Apache License 2.0
18 stars 3 forks source link

stringLiteralToCeylon produces incorrect result for empty string #89

Closed jvasileff closed 9 years ago

jvasileff commented 9 years ago

stringLiteralToCeylon turns empty strings into the string "".

    value ast1 = StringLiteral("", true); // or false
    value rh = RedHatTransformer(SimpleTokenFactory())
                    .transformStringLiteral(ast1);
    value ast2 = stringLiteralToCeylon(rh);
    print("~" + ast1.text + "~"); // ~~
    print("~" + ast2.text + "~"); // ~""~
lucaswerkmeister commented 9 years ago

AAH. Subrange behavior strikes again: text[1 .. (text.length - 2)] == text[1 .. -1] == text[-1 .. 1].reversed. We’ve had that before :(

jvasileff commented 9 years ago

oops! Yeah, I like the prior fix to use :

lucaswerkmeister commented 9 years ago

Should be fixed now.