Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-42711] Fix array element types in the Ruby TCK #3690

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/tck/java/org/truffleruby/tck/RubyTCKLanguageProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public Value createIdentityFunction(Context context) {

@Override
public Collection<? extends Snippet> createValueConstructors(Context context) {
var emptyArrayType = TypeDescriptor.forValue(context.eval(Source.create(getId(), "[]")));

final List<Snippet> vals = new ArrayList<>();
// Interop Primitives
vals.add(createValueConstructor(context, "nil", NULL)); // should also be OBJECT?
Expand All @@ -92,9 +94,9 @@ public Collection<? extends Snippet> createValueConstructors(Context context) {
vals.add(createValueConstructor(context, "[1, 2]", NUMBER_ARRAY_OBJECT));
vals.add(createValueConstructor(context, "[1.2, 3.4]", NUMBER_ARRAY_OBJECT));
vals.add(createValueConstructor(context, "[1<<33, 1<<34]", NUMBER_ARRAY_OBJECT));
vals.add(createValueConstructor(context, "[]", ARRAY_OBJECT));
vals.add(createValueConstructor(context, "[]", emptyArrayType));
vals.add(createValueConstructor(context, "[Object.new]", ARRAY_OBJECT));
vals.add(createValueConstructor(context, "[true, false]", ARRAY_OBJECT));
vals.add(createValueConstructor(context, "[true, false]", BOOLEAN_ARRAY_OBJECT));
vals.add(createValueConstructor(context, "[Object.new, 65]", ARRAY_OBJECT));
vals.add(createValueConstructor(context, "{ 'name' => 'test' }", HASH_ITERABLE_OBJECT));
vals.add(createValueConstructor(context, "Struct.new(:foo, :bar).new(1, 'two')", ITERABLE_OBJECT));
Expand Down Expand Up @@ -297,6 +299,7 @@ private Source getSource(String path) {
private static final TypeDescriptor DATE_TIME_ZONE_OBJECT = intersection(OBJECT, DATE, TIME, TIME_ZONE);
private static final TypeDescriptor ARRAY_OBJECT = intersection(OBJECT, ARRAY);
private static final TypeDescriptor NUMBER_ARRAY_OBJECT = intersection(OBJECT, array(NUMBER));
private static final TypeDescriptor BOOLEAN_ARRAY_OBJECT = intersection(OBJECT, array(BOOLEAN));
private static final TypeDescriptor ITERABLE_OBJECT = intersection(ITERABLE, OBJECT);
private static final TypeDescriptor HASH_ITERABLE_OBJECT = intersection(HASH, ITERABLE, OBJECT);
}
Loading