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

[Spec Deviation] Support declaring listeners without the type-descriptor #18200

Closed
MaryamZi opened this issue Aug 26, 2019 · 0 comments · Fixed by #20717
Closed

[Spec Deviation] Support declaring listeners without the type-descriptor #18200

MaryamZi opened this issue Aug 26, 2019 · 0 comments · Fixed by #20717
Assignees
Labels
Area/Compiler Points/0.5 Equivalent to half a day effort Spec/2019R3 Related to Ballerina Spec 2019R3 Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/SpecDeviation

Comments

@MaryamZi
Copy link
Member

Description:
According to the spec

listener-decl :=
   metadata
   [public] listener [type-descriptor] identifier = expression ;

A listener-decl defines a module listener.

A module-listener can be referenced by a variable-reference, but cannot be modified. It is this similar to a final variable declaration, except that it also registers the value with the module as a listener.

A module listener has a static type, which must be a subtype of the Listener type. If the type-descriptor is present it specifies the module listener's static type; if it is not present, the the static type of the listener is the static type of expression.

Steps to reproduce:
But the current implementation does not support declaring listeners without the type-descriptor.

import ballerina/http;

listener xyz = new http:Listener(8080);
$ ballerina run test.bal 
error: .::test.bal:3:14: mismatched input '='. expecting {'[', '?', '|', Identifier}
error: .::test.bal:3:24: mismatched input ':'. expecting '='
error: .::test.bal:3:33: mismatched input '('. expecting {'[', '?', '|', Identifier}

Affected Versions:

$ ballerina -v
Ballerina 1.0.0-alpha3
Language specification 2019R2
Ballerina tool 1.0.0
@MaryamZi MaryamZi added Area/Compiler Type/SpecDeviation Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. labels Aug 26, 2019
@pubudu91 pubudu91 added this to the Ballerina 1.1.0 milestone Oct 17, 2019
@hasithaa hasithaa removed this from the Ballerina 1.1.0 milestone Dec 18, 2019
@hasithaa hasithaa added Compatibility/Minor Spec/2019R3 Related to Ballerina Spec 2019R3 labels Dec 18, 2019
@MaryamZi MaryamZi added Points/4 Equivalent to four day effort Points/0.5 Equivalent to half a day effort and removed Points/4 Equivalent to four day effort labels Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Compiler Points/0.5 Equivalent to half a day effort Spec/2019R3 Related to Ballerina Spec 2019R3 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