Skip to content

Improve error reporting: provide better literal suffix description #1129

@smoothdeveloper

Description

@smoothdeveloper

What

let foo = 1up

This is not a valid numeric literal. Sample formats include 4, 0x4, 0b0100, 4L, 4UL, 4u, 4s, 4us, 4y, 4uy, 4.0, 4.0f, 4I

Why

It is difficult to remember:

  • the valid suffixes
  • what exact type they correspond to (despite they are kind of logical, if I made a mistake, better remind me the type as well)
  • I was looking for decimal but it isn't there

How

Bonus point if we instead of 4 we show 42 or the actual value.

This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1ui (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger)
#1103

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions