Skip to content

Commit

Permalink
Fix tests - annotated class must extend the generated super class
Browse files Browse the repository at this point in the history
  • Loading branch information
Akirathan committed Dec 24, 2024
1 parent 30f14d9 commit ba602c4
Showing 1 changed file with 43 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void simpleIRNodeWithoutFields_CompilationSucceeds() {
import org.enso.runtime.parser.dsl.GenerateFields;
@GenerateIR
public final class JName {
public final class JName extends JNameGen {
@GenerateFields
public JName() {}
}
Expand Down Expand Up @@ -135,9 +135,11 @@ public void simpleIRNodeWithUserDefinedFiled_CompilationSucceeds() {
import org.enso.runtime.parser.dsl.IRField;
@GenerateIR
public final class JName {
public final class JName extends JNameGen {
@GenerateFields
public JName(@IRField String name) {}
public JName(@IRField String name) {
super(name);
}
}
""";
var genClass = generatedClass("JName", src);
Expand All @@ -153,7 +155,7 @@ public void generatedClassHasProtectedConstructor() {
import org.enso.runtime.parser.dsl.GenerateFields;
@GenerateIR
public final class JName {
public final class JName extends JNameGen {
@GenerateFields
public JName() {}
}
Expand All @@ -173,7 +175,7 @@ public void generatedClassHasConstructor_WithMetaFields() {
import org.enso.runtime.parser.dsl.GenerateFields;
@GenerateIR
public final class JName {
public final class JName extends JNameGen {
@GenerateFields
public JName() {}
}
Expand All @@ -200,7 +202,7 @@ public void generatedClassHasConstructor_WithUserFields() {
import org.enso.runtime.parser.dsl.GenerateFields;
@GenerateIR
public final class JName {
public final class JName extends JNameGen {
@GenerateFields
public JName() {}
}
Expand All @@ -221,7 +223,7 @@ public void generatedClass_IsAbstract() {
import org.enso.runtime.parser.dsl.GenerateFields;
@GenerateIR
public final class JName {
public final class JName extends JNameGen {
@GenerateFields
public JName() {}
}
Expand All @@ -238,7 +240,7 @@ public void annotatedConstructor_MustNotHaveUnannotatedParameters() {
import org.enso.runtime.parser.dsl.GenerateFields;
@GenerateIR
public final class JName {
public final class JName extends JNameGen {
@GenerateFields
public JName(int param) {}
}
Expand All @@ -260,9 +262,11 @@ public void annotatedConstructor_CanHaveMetaParameters() {
import org.enso.compiler.core.ir.MetadataStorage;
@GenerateIR
public final class JName {
public final class JName extends JNameGen {
@GenerateFields
public JName(MetadataStorage passData) {}
public JName(MetadataStorage passData) {
super();
}
}
""";
var compilation = compile("JName", src);
Expand All @@ -281,9 +285,11 @@ public void simpleIRNodeWithChild() {
import org.enso.compiler.core.ir.Expression;
@GenerateIR
public final class MyIR {
public final class MyIR extends MyIRGen {
@GenerateFields
public MyIR(@IRChild Expression expression) {}
public MyIR(@IRChild Expression expression) {
super(expression);
}
}
""");
assertThat(genSrc, containsString("Expression expression()"));
Expand All @@ -301,9 +307,11 @@ public void irNodeWithMultipleFields_PrimitiveField() {
import org.enso.runtime.parser.dsl.IRField;
@GenerateIR
public final class MyIR {
public final class MyIR extends MyIRGen {
@GenerateFields
public MyIR(@IRField boolean suspended) {}
public MyIR(@IRField boolean suspended) {
super(suspended);
}
}
""");
assertThat(genSrc, containsString("boolean suspended()"));
Expand All @@ -323,7 +331,7 @@ interface MySuperIR {
}
@GenerateIR(interfaces = "MySuperIR")
public final class MyIR {
public final class MyIR extends MyIRGen {
@GenerateFields
public MyIR() {}
}
Expand All @@ -350,9 +358,11 @@ interface MySuperIR extends IR {
}
@GenerateIR(interfaces = "MySuperIR")
public final class MyIR {
public final class MyIR extends MyIRGen {
@GenerateFields
public MyIR(@IRField boolean suspended) {}
public MyIR(@IRField boolean suspended) {
super(suspended);
}
}
""");
assertThat(src, containsString("boolean suspended()"));
Expand All @@ -374,9 +384,11 @@ interface MySuperIR extends IR {
}
@GenerateIR
public final class MyIR {
public final class MyIR extends MyIRGen {
@GenerateFields
public MyIR(@IRField boolean suspended) {}
public MyIR(@IRField boolean suspended) {
super(suspended);
}
}
""");
Expand All @@ -402,9 +414,11 @@ interface MySuperIR extends MySuperSuperIR {
}
@GenerateIR(interfaces = "MySuperIR")
public final class MyIR {
public final class MyIR extends MyIRGen {
@GenerateFields
public MyIR(@IRField boolean suspended) {}
public MyIR(@IRField boolean suspended) {
super(suspended);
}
}
""");
assertThat(src, containsString("boolean suspended()"));
Expand Down Expand Up @@ -450,9 +464,11 @@ public void fieldCanBeScalaList() {
import scala.collection.immutable.List;
@GenerateIR
public final class JName {
public final class JName extends JNameGen {
@GenerateFields
public JName(@IRChild List<IR> expressions) {}
public JName(@IRChild List<IR> expressions) {
super(expressions);
}
}
""");
assertThat(src, containsString("class JNameGen"));
Expand All @@ -472,9 +488,11 @@ public void fieldCanBeScalaOption() {
import scala.Option;
@GenerateIR
public final class JName {
public final class JName extends JNameGen {
@GenerateFields
public JName(@IRChild Option<IR> expression) {}
public JName(@IRChild Option<IR> expression) {
super(expression);
}
}
""");
assertThat(src, containsString("class JNameGen"));
Expand Down

0 comments on commit ba602c4

Please sign in to comment.