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] Allow any simple-const-expr in describing singleton types #13410

Closed
MaryamZi opened this issue Jan 30, 2019 · 1 comment · Fixed by #22833
Closed

[Spec Deviation] Allow any simple-const-expr in describing singleton types #13410

MaryamZi opened this issue Jan 30, 2019 · 1 comment · Fixed by #22833
Assignees
Labels
Area/Compiler Points/3 Equivalent to three days effort Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/NewFeature Type/SpecDeviation

Comments

@MaryamZi
Copy link
Member

Description:
As per the spec (v0.990:2019-01-16 - page 29, 30),

"singleton-type-descriptor := simple-const-expr

A singleton type is a type containing a single shape. A singleton type is described using an compile-time constant expression for a single value: the type contains the shape of that value. Note that it is possible for the variable-reference within the simple-const-expr to reference a structured value."

simple-const-expr :=
  nil-literal
  | boolean
  | [Sign] int-literal
  | [floating-point-type] [Sign] floating-point-literal
  | string-literal
  | variable-reference
floating-point-type := < (decimal|float) >

Unsupported expressions need to be supported.

Affected Versions:
0.990.2

@anupama-pathirage anupama-pathirage added the Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. label Apr 30, 2019
@gimantha gimantha added this to the Ballerina 1.1.0 milestone Oct 17, 2019
@hasithaa hasithaa removed this from the Ballerina 1.1.0 milestone Dec 16, 2019
@rdhananjaya rdhananjaya added the Points/0.5 Equivalent to half a day effort label Apr 2, 2020
@MaryamZi
Copy link
Member Author

MaryamZi commented Apr 6, 2020

The updated grammar for simple-const-expr (as of 2020r1) is as follows

simple-const-expr :=
  nil-literal
  | boolean-literal
  | [Sign] int-literal
  | [Sign] floating-point-literal
  | string-literal
  | constant-reference-expr

We need to support the following two expressions;

type D +1;
type F +1.0;

Everything else is supported;

type A ();

type B true;
type C false;

type E -1;

type G -1.0;

type H "str";

type I FOO;

const FOO = "foo";

@pubudu91 pubudu91 added Points/3 Equivalent to three days effort and removed Points/0.5 Equivalent to half a day effort labels Apr 16, 2020
@pubudu91 pubudu91 added this to the Ballerina 1.3.0 milestone Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Compiler Points/3 Equivalent to three days effort Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/NewFeature Type/SpecDeviation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants