ceylon / ceylon.ast

Apache License 2.0
18 stars 3 forks source link

permit empty elements in ImportElements #120

Closed jvasileff closed 8 years ago

jvasileff commented 8 years ago

Basically, I think, remove from ImportElements:

    "Import elements may not be empty"
    assert (nonempty children_ = concatenate(elements, emptyOrSingleton(wildcard)));

The problem I ran into was that for JavaScript and Dart, the following:

import java.nio {
    JavaByteBuffer=ByteBuffer {
        // allocateJavaByteBuffer=allocate
    }
}

is "valid enough" to pass type checking and compile without error (and does, indeed on JS), since java.nio is ignored since it is native("jvm"). The "Import elements may not be empty" error is not a RecognitionError.

See also https://github.com/ceylon/ceylon/issues/6501

Edit: actually, I guess I'm not sure about the error type.

jvasileff commented 8 years ago

Thinking out loud, I wonder what other problems like this I might run into.

Currently, if there are typechecker errors, I don't attempt to create a ceylon.ast. This protects me from AssertionErrors, mostly.

lucaswerkmeister commented 8 years ago

Should I do this in 1.3.0?

jvasileff commented 8 years ago

I vote yes!