daml icon indicating copy to clipboard operation
daml copied to clipboard

Daml Studio "Quick Fix" for Month enum value is incorrect

Open wallacekelly-da opened this issue 3 years ago • 1 comments

Affected Daml version

2.4.0

Bug description

In Daml Studio, when using the "Quick Fix" feature for a Month enum, the quick fix is not correct.

To reproduce

  1. daml new quickfix --template empty-skeleton
  2. cd quickfix
  3. daml studio
  4. Create a new file daml/QuickFix.daml (using code shown below)
  5. Observe that the enum Nov is red-underlined.
  6. Apply the Quick Fix "Add Nov to the import list of DA.Date"
  7. Observe that the line import DA.Date (date) is changed to import DA.Date (Nov, date), with a red underline.

QuickFix.daml

module QuickFix where

import Daml.Script
import DA.Date (date)

repro = script do
    let today = date 2022 Nov 01
    return ()

Expected behavior

The Quick Fix should result in import DA.Date (Month(Nov), date).

Or maybe import DA.Date (Month(..), date) would be even better.

Additional context

I ran into this while working through the Introduction to Daml

wallacekelly-da avatar Nov 01 '22 21:11 wallacekelly-da

I'd be happy to address this issue if someone can point me in the right direction.

wallacekelly-da avatar Nov 01 '22 21:11 wallacekelly-da