Skip to content

Cannot change name of data constructors by editing the type #5694

Open
@kylegoetz

Description

@kylegoetz

Describe and demonstrate the bug

This should be written as a ucm transcript if possible, calling out the unexpected behavior in the text. e.g.

type models.OData
    = UnknownOData Word16 Bytes
    | ODNSID Bytes
    | ODDAU Bytes
    | ODDHU Bytes
    | ODECSGeneric Word16 Word8 Word8 Bytes
    | ODClientSubnet Word8 Word8 (Either IPv4 IPv6)

Then add this

scratch/main> add models.OData

So far so good. But now I say "ahh, wish I would've inserted a _ after each OD in the data constructors. So in the scratch I change them all to things like OD_DAU. Save the scratch file so I'll be prompted to update, but...

type models.OData
  = UnknownOData Word16 Bytes
  | OD_NSID Bytes
  | OD_DAU Bytes
  | OD_DHU Bytes
  | OD_ECSGeneric Word16 Word8 Word8 Bytes
  | OD_ClientSubnet Word8 Word8 (Either IPv4 IPv6)

and I get

dns/main> 

  Loading changes detected in ~/Documents/workspace/unison-code/cbor.u.


  I found and typechecked the definitions in ~/Documents/workspace/unison-code/cbor.u. This file
  has been previously added to the codebase.

I know I can

move models.OData.ODNSID models.OData.OD_NSID

but it seems initially counterintuitive (until you remember that data constructors are quasi-terms) that you can't directly "change the type" by editing it in the scratch file.

Environment (please complete the following information):

  • ucm --version 0.5.39
  • OS/Architecture: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions