mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-21 07:17:25 +03:00
0b27070b2e
If a record type has a field that is a user-defined type, `view` no longer treats the type as a record type. This becomes a big pain because if you want to `edit` the type you have to search around for the proper name and order of the fields to recreate what the record type definition should look like. **Note**: this is really more of an issue than a PR. I've added a failing test case in a transcript but not a fix for the issue.
1.3 KiB
1.3 KiB
Ensure that Records keep their syntax after being added to the codebase
.> builtins.mergeio
.> load unison-src/transcripts-using-base/base.u
Record with 1 field
unique type Record1 = { a : Text }
.> add
.> view Record1
Record with 2 fields
unique type Record2 = { a : Text, b : Int }
.> add
.> view Record2
Record with 3 fields
unique type Record3 = { a : Text, b : Int, c : Nat }
.> add
.> view Record3
Record with many fields
unique type Record4 =
{ a : Text
, b : Int
, c : Nat
, d : Bytes
, e : Text
, f : Nat
, g : [Nat]
}
.> add
.> view Record4
Record with user-defined type fields
This record type has two fields whose types are user-defined (Record4
and UserType
).
unique type UserType = UserType Nat
unique type RecordWithUserType = { a : Text, b : Record4, c : UserType }
.> add
If you view
or edit
it, it should be treated as a record type, but it does not (which is a bug)
.> view RecordWithUserType
Syntax
Trailing commas are allowed.
unique type Record5 =
{ a : Text,
b : Int,
}