package org.simantics.document.server.request;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.simantics.scl.compiler.runtime.RuntimeEnvironment;
import org.simantics.scl.compiler.top.SCLExpressionCompilationException;
import org.simantics.scl.compiler.types.TCon;
+import org.simantics.scl.compiler.types.TMetaVar;
+import org.simantics.scl.compiler.types.TVar;
import org.simantics.scl.compiler.types.Type;
import org.simantics.scl.compiler.types.Types;
import org.simantics.scl.compiler.types.kinds.Kinds;
protected Type getExpectedType(ReadGraph graph, CompilationContext context) throws DatabaseException {
if(possibleExpectedValueType != null) {
try {
- return Environments.getType(context.runtimeEnvironment.getEnvironment(), possibleExpectedValueType);
+ Type type = Environments.getType(context.runtimeEnvironment.getEnvironment(), possibleExpectedValueType);
+ type = Types.instantiate(Types.forAll(Types.freeVars(type).toArray(new TVar[0]), type), new ArrayList<TMetaVar>());
+ return type;
} catch (SCLExpressionCompilationException e) {
LOGGER.error("Could not get type for " + String.valueOf(possibleExpectedValueType), e);
}
package org.simantics.document.server.request;
+import java.util.ArrayList;
import java.util.Map;
import org.simantics.databoard.Bindings;
import org.simantics.scl.compiler.environment.specification.EnvironmentSpecification;
import org.simantics.scl.compiler.runtime.RuntimeEnvironment;
import org.simantics.scl.compiler.top.SCLExpressionCompilationException;
+import org.simantics.scl.compiler.types.TMetaVar;
+import org.simantics.scl.compiler.types.TVar;
import org.simantics.scl.compiler.types.Type;
import org.simantics.scl.compiler.types.Types;
import org.simantics.scl.compiler.types.kinds.Kinds;
protected Type getExpectedType(ReadGraph graph, CompilationContext context) throws DatabaseException {
if(possibleExpectedValueType != null) {
try {
- return Environments.getType(context.runtimeEnvironment.getEnvironment(), possibleExpectedValueType);
+ Type type = Environments.getType(context.runtimeEnvironment.getEnvironment(), possibleExpectedValueType);
+ type = Types.instantiate(Types.forAll(Types.freeVars(type).toArray(new TVar[0]), type), new ArrayList<TMetaVar>());
+ return type;
} catch (SCLExpressionCompilationException e) {
LOGGER.error("Could not get type for " + String.valueOf(possibleExpectedValueType), e);
}