Skip to content

Commit 8abc510

Browse files
committed
More projects
As cherry-picked from #11321
1 parent 7cce490 commit 8abc510

File tree

7 files changed

+51
-41
lines changed

7 files changed

+51
-41
lines changed

build.sbt

+5
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ lazy val enso = (project in file("."))
343343
`project-manager`,
344344
`refactoring-utils`,
345345
runtime,
346+
`runtime-and-langs`,
346347
`runtime-benchmarks`,
347348
`runtime-compiler`,
348349
`runtime-integration-tests`,
@@ -353,15 +354,19 @@ lazy val enso = (project in file("."))
353354
`runtime-instrument-id-execution`,
354355
`runtime-instrument-repl-debugger`,
355356
`runtime-instrument-runtime-server`,
357+
`runtime-integration-tests`,
358+
`runtime-parser`,
356359
`runtime-suggestions`,
357360
`runtime-version-manager`,
358361
`runtime-version-manager-test`,
362+
`runtime-test-instruments`,
359363
`scala-libs-wrapper`,
360364
`scala-yaml`,
361365
searcher,
362366
semver,
363367
`std-aws`,
364368
`std-base`,
369+
`std-benchmarks`,
365370
`std-database`,
366371
`std-google-api`,
367372
`std-image`,

engine/runtime-test-instruments/src/main/java/module-info.java

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
provides org.graalvm.polyglot.tck.LanguageProvider with
1111
org.enso.interpreter.test.instruments.tck.EnsoTckLanguageProvider;
12-
1312
provides com.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProvider with
1413
org.enso.interpreter.test.instruments.CodeIdsTestInstrumentProvider,
1514
org.enso.interpreter.test.instruments.CodeLocationsTestInstrumentProvider,

engine/runtime-test-instruments/src/main/java/org/enso/interpreter/test/instruments/CodeIdsTestInstrument.java

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.oracle.truffle.api.nodes.Node;
66
import java.util.LinkedHashMap;
77
import java.util.Map;
8-
98
import java.util.UUID;
109
import org.enso.interpreter.test.instruments.service.RuntimeTestService;
1110
import org.openide.util.Lookup;

engine/runtime-test-instruments/src/main/java/org/enso/interpreter/test/instruments/NodeCountingTestInstrument.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.oracle.truffle.api.instrumentation.TruffleInstrument;
99
import com.oracle.truffle.api.nodes.Node;
1010
import com.oracle.truffle.api.source.SourceSection;
11-
1211
import java.util.List;
1312
import java.util.Map;
1413
import java.util.UUID;
@@ -77,10 +76,12 @@ public Map<Class, List<Node>> assertNewNodes(String msg, int min, int max) {
7776
};
7877

7978
if (value < min) {
80-
throw new AssertionError(dump.apply(msg + ". Minimal size should be " + min + ", but was: " + value + " in"));
79+
throw new AssertionError(
80+
dump.apply(msg + ". Minimal size should be " + min + ", but was: " + value + " in"));
8181
}
8282
if (value > max) {
83-
throw new AssertionError(dump.apply(msg + ". Maximal size should be " + max + ", but was: " + value + " in"));
83+
throw new AssertionError(
84+
dump.apply(msg + ". Maximal size should be " + max + ", but was: " + value + " in"));
8485
}
8586
counter = new ConcurrentHashMap<>();
8687
return prev;
@@ -131,7 +132,6 @@ public void onReturnValue(VirtualFrame frame, Object result) {
131132
calls.put(nodeId, funcCallInfo);
132133
}
133134
}
134-
135135
}
136136
}
137137
}

engine/runtime-test-instruments/src/main/java/org/enso/interpreter/test/instruments/service/FunctionCallInfo.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package org.enso.interpreter.test.instruments.service;
22

3-
public record FunctionCallInfo(
4-
String moduleName,
5-
String typeName,
6-
String functionName
7-
) {
3+
public record FunctionCallInfo(String moduleName, String typeName, String functionName) {
84

95
@Override
106
public String toString() {
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package org.enso.interpreter.test.instruments.service;
22

33
import com.oracle.truffle.api.nodes.Node;
4-
import com.oracle.truffle.api.nodes.RootNode;
54
import java.util.UUID;
6-
import org.enso.interpreter.test.instruments.service.FunctionCallInfo;
75

86
/**
97
* A service that provides information from the `runtime` project to the instruments in this project
@@ -12,9 +10,14 @@
1210
*/
1311
public interface RuntimeTestService {
1412
UUID getNodeID(Node node);
13+
1514
boolean isExpressionNode(Object node);
15+
1616
boolean isTailCallException(Object obj);
17+
1718
boolean isFunctionCallInstrumentationNode(Object node);
19+
1820
boolean isFunctionCall(Object obj);
21+
1922
FunctionCallInfo extractFunctionCallInfo(Object functionCall);
2023
}

engine/runtime-test-instruments/src/main/java/org/enso/interpreter/test/instruments/tck/EnsoTckLanguageProvider.java

+36-28
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.util.Collection;
44
import java.util.List;
5-
65
import org.graalvm.polyglot.Context;
76
import org.graalvm.polyglot.Source;
87
import org.graalvm.polyglot.Value;
@@ -11,8 +10,7 @@
1110
import org.graalvm.polyglot.tck.TypeDescriptor;
1211

1312
public class EnsoTckLanguageProvider implements LanguageProvider {
14-
public EnsoTckLanguageProvider() {
15-
}
13+
public EnsoTckLanguageProvider() {}
1614

1715
@Override
1816
public String getId() {
@@ -34,42 +32,52 @@ public Collection<? extends Snippet> createValueConstructors(Context context) {
3432

3533
@Override
3634
public Collection<? extends Snippet> createExpressions(Context context) {
37-
var plus = context.eval("enso", """
35+
var plus =
36+
context
37+
.eval("enso", """
3838
plus a b = a + b
39-
""").invokeMember("eval_expression", "plus");
39+
""")
40+
.invokeMember("eval_expression", "plus");
4041

4142
return List.of(
42-
/* disabled until + is defined on Numbers again
43-
Snippet.newBuilder("plus:Number", plus, TypeDescriptor.NUMBER)
44-
.parameterTypes(TypeDescriptor.NUMBER, TypeDescriptor.NUMBER)
45-
.build(),
46-
*/
47-
Snippet.newBuilder("plus:Text", plus, TypeDescriptor.STRING)
48-
.parameterTypes(TypeDescriptor.STRING, TypeDescriptor.STRING)
49-
.build()
50-
);
43+
/* disabled until + is defined on Numbers again
44+
Snippet.newBuilder("plus:Number", plus, TypeDescriptor.NUMBER)
45+
.parameterTypes(TypeDescriptor.NUMBER, TypeDescriptor.NUMBER)
46+
.build(),
47+
*/
48+
Snippet.newBuilder("plus:Text", plus, TypeDescriptor.STRING)
49+
.parameterTypes(TypeDescriptor.STRING, TypeDescriptor.STRING)
50+
.build());
5151
}
5252

5353
@Override
5454
public Collection<? extends Snippet> createStatements(Context context) {
55-
var when = context.eval("enso", """
55+
var when =
56+
context
57+
.eval("enso", """
5658
when c = if c then 1 else -1
57-
""").invokeMember("eval_expression", "when");;
58-
var which = context.eval("enso", """
59+
""")
60+
.invokeMember("eval_expression", "when");
61+
;
62+
var which =
63+
context
64+
.eval(
65+
"enso",
66+
"""
5967
which c = case c of
6068
0 -> "zero"
6169
1 -> "one"
6270
2 -> "two"
6371
_ -> "a lot"
64-
""").invokeMember("eval_expression", "which");
72+
""")
73+
.invokeMember("eval_expression", "which");
6574
return List.of(
66-
Snippet.newBuilder("if", when, TypeDescriptor.NUMBER)
67-
.parameterTypes(TypeDescriptor.BOOLEAN)
68-
.build(),
69-
Snippet.newBuilder("if", which, TypeDescriptor.STRING)
70-
.parameterTypes(TypeDescriptor.NUMBER)
71-
.build()
72-
);
75+
Snippet.newBuilder("if", when, TypeDescriptor.NUMBER)
76+
.parameterTypes(TypeDescriptor.BOOLEAN)
77+
.build(),
78+
Snippet.newBuilder("if", which, TypeDescriptor.STRING)
79+
.parameterTypes(TypeDescriptor.NUMBER)
80+
.build());
7381
}
7482

7583
@Override
@@ -80,9 +88,9 @@ public Collection<? extends Snippet> createScripts(Context context) {
8088
@Override
8189
public Collection<? extends Source> createInvalidSyntaxScripts(Context context) {
8290
return List.of(
83-
Source.newBuilder("enso", """
91+
Source.newBuilder("enso", """
8492
main = x + 2
85-
""", "unknown_x.enso").buildLiteral()
86-
);
93+
""", "unknown_x.enso")
94+
.buildLiteral());
8795
}
8896
}

0 commit comments

Comments
 (0)