Skip to content

Commit

Permalink
Fixed an issue in the java generated code for deepclone of values (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushdesai committed Nov 14, 2023
1 parent 1e11ea7 commit ed6f19c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Src/PCompiler/CompilerCore/Backend/Java/JavaSourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,11 @@ internal void WriteClone(TypeManager.JType t, Action writeTermToBeCloned)
case TypeManager.JType.JMap _:
case TypeManager.JType.JList _:
case TypeManager.JType.JSet _:
Write($"{Constants.PrtDeepCloneMethodName}(");
writeTermToBeCloned();
Write(")");
break;

/* JNamedTuples and foreign types extend prt.values.PValue, and thus have an explicit `.deepEquals()`
* method. (We could have just as easily passed these to the runtime's `deepClone` method, but this
* saves us a type dispatch). */
case TypeManager.JType.JForeign _:
case TypeManager.JType.JNamedTuple _:
Write($"{Constants.PrtDeepCloneMethodName}(");
writeTermToBeCloned();
Write(".deepClone()");
Write(")");
break;

default:
Expand Down

0 comments on commit ed6f19c

Please sign in to comment.