Skip to content

FR: add a way to suppress warning on migration dropping field #5301

@crusso

Description

@crusso
WARN: /home/runner/work/motoko-benchmark/motoko-benchmark/benchmarks/application/tmp/car-sharing-upgrade/main.mo:11.7-11.32: warning [M0207], migration expression consumes field `minCarCapacity` of type
  Nat
but does not produce it. The field is not declared in the actor.
This field will be removed from the actor, discarding its consumed value.
If this removal is unintended, declare the field in the actor and either remove the field from the parameter of the migration function or add it to the result of the migration function.

There is no way to suppress this warning, even if discard is intentional.

We could maybe look for an explicit comment on the field to suppress the warning.

/// @deleted
var x : Nat (edited)

or use a specially named type

var x : (deleted: Nat)

Suppressing all these warnings is probably a bad idea, since some data may be unintentionally lost.

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