import org.simantics.scl.compiler.types.util.TypeUnparsingContext;
import gnu.trove.map.hash.THashMap;
-import gnu.trove.map.hash.TObjectIntHashMap;
-import gnu.trove.set.hash.TIntHashSet;
public class EAmbiguous extends SimplifiableExpression {
public static final boolean DEBUG = false;
this.activeCount = alternatives.length;
}
- @Override
- public void collectVars(TObjectIntHashMap<Variable> allVars,
- TIntHashSet vars) {
- }
-
@Override
protected void updateType() throws MatchException {
throw new InternalCompilerError();
THashMap<TMetaVar,Type> unifications = new THashMap<TMetaVar,Type>();
Type requiredType = getType();
if(DEBUG)
- System.out.println("EAmbigious.filterActive with " + requiredType);
+ System.out.println("EAmbigious.filterActive with " + requiredType.toStringSkeleton());
for(int i=0;i<alternatives.length;++i)
if(active[i]) {
unifications.clear();
StringBuilder b = new StringBuilder();
b.append("Expected <");
requiredType.toString(new TypeUnparsingContext(), b);
- b.append(">, but no alteratives match the type: ");
+ b.append(">, but no alternatives match the type: ");
for(int i=0;i<alternatives.length;++i) {
b.append("\n ");
b.append(alternatives[i]);
private void listenType() {
if(DEBUG)
- System.out.println("EAmbigious.listenType " + getType());
+ System.out.println("EAmbigious.listenType " + getType().toStringSkeleton());
new TypeListener() {
@Override
public void notifyAboutChange() {
if(DEBUG)
- System.out.println("EAmbigious.notifyAboutChange " + getType());
+ System.out.println("EAmbigious.notifyAboutChange " + getType().toStringSkeleton());
Type requiredType = getType();
filterActive();
if(activeCount == 0) {
if(resolvedExpression != null)
return resolvedExpression;
else {
+ if(DEBUG)
+ System.out.println("EAmbigious.simplify: error");
context.getErrorLog().log(location, getAmbiguousDescription(getType()));
return this;
}
}
public void assertResolved(ErrorLog errorLog) {
- if(resolvedExpression == null)
+ if(resolvedExpression == null) {
+ if(DEBUG)
+ System.out.println("EAmbigious.assertResolved: error");
errorLog.log(location, getAmbiguousDescription(getType()));
+ }
}
@Override