Skip to content

Commit 318f181

Browse files
authored
bugfix: fix for #3140 continued (#3143)
Continues the saga of fixing #3140 by being more careful about deciding how to elide type bindings for prelude defined prims. c.f. https://forum.dfinity.org/t/persistent-stable-interface-compatibility-check-failed-error/11281/9?u=claudio
1 parent 860ff62 commit 318f181

File tree

7 files changed

+94
-3
lines changed

7 files changed

+94
-3
lines changed

src/mo_types/type.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,9 +1397,9 @@ and pp_stab_sig ppf sig_ =
13971397
let ds =
13981398
let cs' = ConSet.filter (fun c ->
13991399
match Cons.kind c with
1400-
| Def ([], Prim p) when Cons.name c = string_of_prim p -> false
1401-
| Def ([], Any) when Cons.name c = "Any" -> false
1402-
| Def ([], Non) when Cons.name c = "None" -> false
1400+
| Def ([], Prim p) when string_of_con c = string_of_prim p -> false
1401+
| Def ([], Any) when string_of_con c = "Any" -> false
1402+
| Def ([], Non) when string_of_con c = "None" -> false
14031403
| Def _ -> true
14041404
| Abs _ -> false) cs in
14051405
ConSet.elements cs' in

test/run-drun/issue-3140-c.mo

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import Prim = "mo:⛔";
2+
actor {
3+
4+
type None = Prim.Types.None;
5+
type Null = Prim.Types.Null;
6+
type Bool = Prim.Types.Bool;
7+
type Nat = Prim.Types.Nat;
8+
type Nat8 = Prim.Types.Nat8;
9+
type Nat16 = Prim.Types.Nat16;
10+
type Nat32 = Prim.Types.Nat32;
11+
type Nat64 = Prim.Types.Nat64;
12+
type Int = Prim.Types.Int;
13+
type Int8 = Prim.Types.Int8;
14+
type Int16 = Prim.Types.Int16;
15+
type Int32 = Prim.Types.Int32;
16+
type Int64 = Prim.Types.Int64;
17+
type Float = Prim.Types.Float;
18+
type Char = Prim.Types.Char;
19+
type Text = Prim.Types.Text;
20+
type Blob = Prim.Types.Blob;
21+
type Error = Prim.Types.Error;
22+
type Principal = Prim.Types.Principal;
23+
24+
type Fresh = ?Fresh;
25+
26+
type T = (
27+
None,
28+
Null,
29+
Bool,
30+
Nat,
31+
Nat8,
32+
Nat16,
33+
Nat32,
34+
Nat64,
35+
Int,
36+
Int8,
37+
Int16,
38+
Int32,
39+
Int64,
40+
Float,
41+
Char,
42+
Text,
43+
Blob,
44+
//Error,
45+
Principal,
46+
Fresh
47+
);
48+
49+
stable var t = [] : [T];
50+
}

test/run-drun/issue-3140-d.mo

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import Prim = "mo:⛔";
2+
actor {
3+
4+
type Fresh = ?Fresh;
5+
type T = (
6+
None,
7+
Null,
8+
Bool,
9+
Nat,
10+
Nat8,
11+
Nat16,
12+
Nat32,
13+
Nat64,
14+
Int,
15+
Int8,
16+
Int16,
17+
Int32,
18+
Int64,
19+
Float,
20+
Char,
21+
Text,
22+
Blob,
23+
//Error,
24+
Principal,
25+
Fresh
26+
);
27+
28+
stable var t = [] : [T];
29+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
2+
ingress Completed: Reply: 0x4449444c0000
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
→ update create_canister(record {settings = null})
2+
← replied: (record {hymijyo = principal "cvccv-qqaaq-aaaaa-aaaaa-c"})
3+
→ update install_code(record {arg = blob ""; kca_xin = blob "\00asm\01\00\00\00\0…
4+
← replied: ()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
2+
ingress Completed: Reply: 0x4449444c0000
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
→ update create_canister(record {settings = null})
2+
← replied: (record {hymijyo = principal "cvccv-qqaaq-aaaaa-aaaaa-c"})
3+
→ update install_code(record {arg = blob ""; kca_xin = blob "\00asm\01\00\00\00\0…
4+
← replied: ()

0 commit comments

Comments
 (0)