Skip to content

Commit

Permalink
Make sure the richest constructor (that includes all variables) is us…
Browse files Browse the repository at this point in the history
…ed by @Persistable
  • Loading branch information
JaroslavTulach committed Nov 15, 2023
1 parent 95ff6a0 commit 5cb4b68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public void testCompareList() throws Exception {
var meta = new ModuleCache.Metadata("hash", "code", CompilationStage.AFTER_CODEGEN.toString());
var cachedIr = module.getCache().deserialize(ensoCtx, arr, meta, null);
assertNotNull("IR read", cachedIr);
CompilerTest.assertIR(name, module.getIr(), cachedIr.moduleIR());
for (var node : ScalaConversions.asJava(cachedIr.moduleIR().preorder())) {
node.passData().prepareForSerialization(ensoCtx.getCompiler().context());
}
CompilerTest.assertIR(name, ir, cachedIr.moduleIR());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ private boolean generatePersistance(Element orig, Persistable anno) throws IOExc
var ea = (ExecutableElement)a;
var eb = (ExecutableElement)b;

return ea.getParameters().size() - eb.getParameters().size();
return eb.getParameters().size() - ea.getParameters().size();
})
.toList();
if (constructors.size() == 0) {
if (constructors.isEmpty()) {
processingEnv.getMessager().printMessage(Kind.ERROR, "There should be exactly one constructor in " + typeElem);
return false;
}
Expand Down

0 comments on commit 5cb4b68

Please sign in to comment.