-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
closed-as-intendedClosed as the reported issue is expected behaviorClosed as the reported issue is expected behaviortype-questionA question about expected behavior or functionalityA question about expected behavior or functionality
Description
The code below produces an error in both CFE and the analyzer.
main() {
int i = 0;
<int>{
if (2 > 1) i // Ok
};
{
if (2 > 1) i // Error: Expected ';' after this.
};
{
if (2 > 1) i, // Error: Expected ';' after this.
};
<int>{
if (2 > 1) i; // Error: Expected '}' before this.
};
{
if (2 > 1) i; // Ok
};
// But!
print({
if (2 > 1) i // Ok
});
print({
if (2 > 1) i; // Error: Expected '}' before this.
});
}According to the grammar ; is not allowed in set literals. So, I believe, that the extected result is:
{
if (2 > 1) i // Should be allowed with and without trailing `,`
};
{
if (2 > 1) i; // Expect an error
};cc @eernstg to confirm.
Dart SDK version: 3.8.0-66.0.dev (dev) (Sun Feb 2 20:05:47 2025 -0800) on "windows_x64"
Metadata
Metadata
Assignees
Labels
closed-as-intendedClosed as the reported issue is expected behaviorClosed as the reported issue is expected behaviortype-questionA question about expected behavior or functionalityA question about expected behavior or functionality