Skip to content
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

Issues with XML subtypes #22069

Closed
MaryamZi opened this issue Mar 23, 2020 · 1 comment · Fixed by #22323
Closed

Issues with XML subtypes #22069

MaryamZi opened this issue Mar 23, 2020 · 1 comment · Fixed by #22323
Assignees
Labels
Points/6 Equivalent to six days effort Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/SpecDeviation

Comments

@MaryamZi
Copy link
Member

Description:
Case I
The spec says "A shape belongs to type xml<T> if all of its constituent items belong to T. So, for example, xml<xml:Element> is the type for xml values containing only elements.".

But this validation does not seem to happen atm. For example, the following does not fail.

import ballerina/lang.'xml;

public function main() {
    xml<'xml:Element> e = xml `<!--I'm a comment-->`;
}

Case II
The spec also says "Note that xml<xml<T>> is the same as xml<T> and that xml<xml:Text> is the same as xml:Text.".

So shouldn't the following be allowed?

import ballerina/lang.'xml;

public function main() {
    'xml:Comment e = xml `<!--I'm a comment-->`;
}

Currently results in a compilation error.

$ ballerina run test.bal 
Compiling source
        test.bal
error: .::test.bal:4:27: incompatible types: expected 'xml:Comment', found 'xml'

Affected Versions:
1.2.0

@MaryamZi MaryamZi added Type/SpecDeviation Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Spec/2020R1 labels Mar 23, 2020
@hasithaa hasithaa added the Points/4 Equivalent to four day effort label Mar 23, 2020
@rdhananjaya
Copy link
Member

Also note xml:Text also allows the empty xml value. from the spec.

@hasithaa hasithaa added Points/7 Equivalent to seven day effort Points/6 Equivalent to six days effort and removed Points/4 Equivalent to four day effort Points/7 Equivalent to seven day effort labels Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Points/6 Equivalent to six days effort Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/SpecDeviation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants