Skip to content

Incorrect diagnostic for illegal record syntax when the field is used

Prelude> data F a = F a { f :: a }; t = F { f = 'c' }

<interactive>:1:36: error: Not in scope: ‘f’

Expected behavior

    • Record syntax is illegal here: {f :: a}
    • In the type ‘{f :: a}’
      In the definition of data constructor ‘F’
      In the data declaration for ‘F’

What is interesting, is that this is a parser error that gets masked by some "in scope" error. Should this not already be rejected by the parser?

  • GHC version used: 8.6.1 and HEAD
Edited by dminuoso
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information