File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1250,6 +1250,13 @@ export fn{Test} main {
12501250 test
12511251 .assert(eq, maybe5.exists, true)
12521252 .assert(eq, maybeNot.exists, false);
1253+ })
1254+ .it('can be cloned', fn (test: Mut{Testing}) {
1255+ const maybe5 = Maybe{i64}(5);
1256+ const maybeNot = Maybe{i64}();
1257+ test
1258+ .assert(eq, maybe5.clone.exists, true)
1259+ .assert(eq, maybeNot.clone.exists, false);
12531260 });
12541261
12551262 test.describe("Tree")
Original file line number Diff line number Diff line change @@ -130,7 +130,9 @@ export class FuzzySet {
130130}
131131
132132export function clone ( v ) {
133- if ( v instanceof Array ) {
133+ if ( v === null ) {
134+ return null ;
135+ } else if ( v instanceof Array ) {
134136 return v . map ( clone ) ;
135137 } else if ( v instanceof FuzzySet ) {
136138 return v . union ( new FuzzySet ( ) ) ;
You can’t perform that action at this time.
0 commit comments