ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.58k stars 738 forks source link

Compilation errors when defining a type with union of consts #16646

Closed Manuri closed 3 years ago

Manuri commented 5 years ago

Description: Following gives compilation errors

public const TIME_DELTA_START = "TIME_DELTA_START";
public const SEQUNECE_NUMBER = "SEQUNECE_NUMBER";

type X TIME_DELTA_START | SEQUENCE_NUMBER;
type TIME_OR_SEQUENCE_NO [X, int];

Errors:

 ERROR: ballerina/nats::streaming/annotation.bal:56:8:: unknown type 'TIME_DELTA_START'
 ERROR: ballerina/nats::streaming/annotation.bal:56:27:: unknown type 'SEQUENCE_NUMBER'

Following works

type X "TIME_DELTA_START" | "SEQUENCE_NUMBER";
type TIME_OR_SEQUENCE_NO [X, int];
rdhananjaya commented 5 years ago

Error is due to a typo in const definition SEQUNECE_NUMBER, when changed to SEQUENCE_NUMBER it goes away.

rdhananjaya commented 5 years ago

But even when there is this typo there should not be 2 error messages printed as TIME_DELTA_START is correct.

mohanvive commented 3 years ago

Above issue is not there is the master now. Hence, closing the issue.