dotnet / dotnet/fsharp

Code attribute with literal constant demands parenthesis

Open
#5,316 1 comment 0 reactions 1 assignee Claimed by @edgarfgp View on GitHub
Area-Compiler-Syntax Feature Improvement
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

A code attribute using a declared named literal constant demands a parenthesis in order to compile.

![image](https://user-images.githubusercontent.com/15068882/42438900-adfeaf2a-8361-11e8-8b68-9d815c0d69c1.png)

I actually have two issues with this.

1) Why does it need parenthesis for the literal constant, when it does not for the literal string?

2) The error messages do not explain what the real problem is, and it's really hard to understand considering the literal string thing works. I asked on Slack and was told by Phillip Carter how to fix this - with a parenthesis, as shown right above the failing line.

I suggest 1) fix the syntax or 2) improve error message(s).

#### Repro steps

Just paste in that piece of code, and try to compile.

#### Related information

.NET Core Console Application in VS 15.7.4.

Severity: Not a serious problem, just annoying.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.