Skip to content

Commit

Permalink
CR: use ScalaConversions where it makes more sense
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Jan 7, 2025
1 parent 53f1930 commit 5f515ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
import org.enso.compiler.pass.resolve.Patterns$;
import org.enso.compiler.pass.resolve.TypeNames$;
import org.enso.compiler.pass.resolve.TypeSignatures$;
import org.enso.scala.wrapper.ScalaConversions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.Option;
import scala.collection.immutable.Seq;
import scala.collection.immutable.Seq$;
import scala.jdk.javaapi.CollectionConverters;

/**
* The compiler pass implementing the proof of concept of type inference.
Expand Down Expand Up @@ -143,13 +142,12 @@ public Seq<IRProcessingPass> precursorPasses() {
TypeSignatures$.MODULE$,
StaticModuleScopeAnalysis.INSTANCE,
TypeInferenceSignatures.INSTANCE);
return CollectionConverters.asScala(passes).toList();
return ScalaConversions.seq(passes);
}

@Override
@SuppressWarnings("unchecked")
public Seq<IRProcessingPass> invalidatedPasses() {
return (Seq<IRProcessingPass>) Seq$.MODULE$.empty();
return ScalaConversions.nil();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scala.collection.immutable.Seq;
import scala.collection.immutable.Seq$;
import scala.jdk.javaapi.CollectionConverters;

// TODO it may make sense to merge this pass into StaticModuleScopeAnalysis, there is little benefit
// to keeping it separate
Expand Down Expand Up @@ -72,13 +70,12 @@ public Seq<IRProcessingPass> precursorPasses() {
TypeNames$.MODULE$,
Patterns$.MODULE$,
TypeSignatures$.MODULE$);
return CollectionConverters.asScala(passes).toList();
return ScalaConversions.seq(passes);
}

@Override
@SuppressWarnings("unchecked")
public Seq<IRProcessingPass> invalidatedPasses() {
return (Seq<IRProcessingPass>) Seq$.MODULE$.empty();
return ScalaConversions.nil();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@
import org.enso.compiler.pass.analyse.types.TypeRepresentation;
import org.enso.persist.Persistance;
import org.enso.pkg.QualifiedName;
import org.enso.scala.wrapper.ScalaConversions;
import org.junit.Test;
import scala.jdk.javaapi.CollectionConverters$;

/**
* Currently the static type inference pass is optional and it is not computed as part of the cache
* indexing.
*/
public class TypeMetadataPersistanceTest {
private static <T> scala.collection.immutable.List<T> makeScalaList(List<T> list) {
return CollectionConverters$.MODULE$.asScala(list).toList();
}

private static <T> T serde(Class<T> clazz, T l) throws IOException {
var arr = Persistance.write(l, null);
var ref = Persistance.read(arr, null);
Expand All @@ -39,7 +35,7 @@ public void writeSomeInferredType() throws Exception {
}

private TypeRepresentation.TypeObject mockObject() {
var fqn = new QualifiedName(makeScalaList(List.of("mod")), "Test");
var fqn = new QualifiedName(ScalaConversions.seq(List.of("mod")).toList(), "Test");
return new TypeRepresentation.TypeObject(fqn);
}
}

0 comments on commit 5f515ff

Please sign in to comment.