fix(muscript): it builds again
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Johannes Frohnmeyer 2023-08-14 15:24:44 +02:00
parent b2887a3ed6
commit b91e15e352
Signed by: Johannes
GPG Key ID: E76429612C2929F4
4 changed files with 10 additions and 12 deletions

View File

@ -12,6 +12,7 @@ import io.gitlab.jfronny.muscript.error.LocationalException;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.*;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@ -198,7 +199,7 @@ public class StandardLib {
public static Dynamic<?> fold(DList args) {
if (args.size() != 3) throw new IllegalArgumentException("Invalid number of arguments for fold: expected 3 but got " + args.size());
return args.get(0).asList().getValue().stream().reduce(args.get(1), args.get(2).asCallable()::call);
return args.get(0).asList().getValue().stream().<Dynamic<?>>map(Function.identity()).reduce(args.get(1), args.get(2).asCallable()::call);
}
public static Dynamic<?> forEach(DList args) {

View File

@ -97,7 +97,7 @@ public class Call extends DynamicExpr {
}
public record Arg(DynamicExpr expr, boolean variadic) {
public Stream<Dynamic<?>> get(Scope dataRoot) {
public Stream<? extends Dynamic<?>> get(Scope dataRoot) {
return variadic ? expr.get(dataRoot).asList().getValue().stream() : Stream.of(expr.get(dataRoot));
}

View File

@ -3,16 +3,14 @@ package io.gitlab.jfronny.muscript.data.dynamic.additional;
import io.gitlab.jfronny.muscript.ast.DynamicExpr;
import io.gitlab.jfronny.muscript.ast.dynamic.*;
import io.gitlab.jfronny.muscript.compiler.CodeLocation;
import io.gitlab.jfronny.muscript.compiler.ExprWriter;
import io.gitlab.jfronny.muscript.data.dynamic.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;
public record DCallableObject(Map<String, Dynamic<?>> value, DCallable callable) implements DObject {
public record DCallableObject(Map<String, ? extends Dynamic<?>> value, DCallable callable) implements DObject {
@Override
public Map<String, Dynamic<?>> getValue() {
public Map<String, ? extends Dynamic<?>> getValue() {
return value;
}

View File

@ -5,23 +5,22 @@ import io.gitlab.jfronny.muscript.ast.DynamicExpr;
import io.gitlab.jfronny.muscript.ast.dynamic.Call;
import io.gitlab.jfronny.muscript.ast.dynamic.Variable;
import io.gitlab.jfronny.muscript.ast.literal.StringLiteral;
import io.gitlab.jfronny.muscript.compiler.*;
import io.gitlab.jfronny.muscript.compiler.CodeLocation;
import io.gitlab.jfronny.muscript.data.dynamic.*;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.*;
/**
* An enum represented as an OObject.
* May also have a selected value with automatic conversions to a number (index) and string
*/
public record DEnum(Map<String, Dynamic<?>> values, @Nullable DEnumEntry value) implements DObject {
public DEnum(Map<String, Dynamic<?>> values) {
public record DEnum(Map<String, ? extends Dynamic<?>> values, @Nullable DEnumEntry value) implements DObject {
public DEnum(Map<String, ? extends Dynamic<?>> values) {
this(values, (DEnumEntry) null);
}
public DEnum(Map<String, Dynamic<?>> values, @Nullable String value) {
public DEnum(Map<String, ? extends Dynamic<?>> values, @Nullable String value) {
this(values, value == null ? null : new DEnumEntry(value, values.keySet().stream().toList().indexOf(value), true));
}
@ -34,7 +33,7 @@ public record DEnum(Map<String, Dynamic<?>> values, @Nullable DEnumEntry value)
}
@Override
public Map<String, Dynamic<?>> getValue() {
public Map<String, ? extends Dynamic<?>> getValue() {
return values;
}