-
Notifications
You must be signed in to change notification settings - Fork 855
Later errors obscure earlier errors #13697
Copy link
Copy link
Labels
AI-thinks-issue-fixedArea-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnosticsBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.Theme-Simple-F#A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language.A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language.
Milestone
Metadata
Metadata
Assignees
Labels
AI-thinks-issue-fixedArea-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnosticsBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.Theme-Simple-F#A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language.A cross-community initiative called "Simple F#", keeping people in the sweet spot of the language.
Type
Fields
Give feedbackNo fields configured for Bug.
Projects
Status
In Progress
Using
typof<SomeType>can lead to confusing error messages when used as an argument for an attribute.Repro steps
Try this code:
Expected behavior
Should give the same error as normal use of
typeof, i.e. that the type is not defined. The expected error is: "FS0039 The type 'OutOfScopeType' is not defined."In other words, I'd expect it similar to this:
Actual behavior
A different error is shown and the whole expression is underlined.
I should note that if you hover over the type-part, both errors are shown.
Known workarounds
N/A
Related information
This reported has lead to confusion with users. For instance, see this post, where a programmer thought that
typeofas a whole was not allowed (and I know I fell for this trap in the past as well): https://stackoverflow.com/questions/18369922/f-attributes-typeof-and-this-is-not-a-constant-expression.