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();
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) {
public TypeAst toTypeAst(TypeUnparsingContext context) {
TypeAst domainAst = domain.toTypeAst(context);
TypeAst rangeAst = range.toTypeAst(context);
- if(Types.canonical(effect) != Types.NO_EFFECTS)
+ if(Types.canonical(effect) != Types.NO_EFFECTS && !context.showSkeletons)
rangeAst = new TEffectAst(effect.toTypeAst(context), rangeAst);
Type dom = Types.canonical(domain);
if(dom instanceof TPred)
@Override
public TypeAst toTypeAst(TypeUnparsingContext context) {
- if(ref == null)
- return new TVarAst(/*polarity.getSymbol() +*/ context.getName(this));
- else
+ if(ref != null)
return ref.toTypeAst(context);
+ else if(context.showSkeletons && skeletonRef != null)
+ return skeletonRef.toTypeAst(context);
+ else
+ return new TVarAst(/*polarity.getSymbol() +*/ context.getName(this));
}
@Override
// Common case
if(skeletonRef != null) {
Skeletons.unifySkeletons(thisSkeleton, type);
+ if(ref != null) {
+ Types.unify(this, type);
+ return;
+ }
}
setRefBase(type);
}
public abstract Kind getKind(Environment context);
- public abstract Type[] skeletonCanonicalChildren();
+ public abstract Type[] skeletonCanonicalChildren();
+
+ public String toStringSkeleton() {
+ TypeUnparsingContext tuc = new TypeUnparsingContext();
+ tuc.showSkeletons = true;
+ return toString(tuc);
+ }
}
\ No newline at end of file
THashMap<Object, String> names;
int nameId;
+ public boolean showSkeletons;
public TypeUnparsingContext() {
this.names = new THashMap<Object, String>();
endTime = nanoTime ()
(result, Java.l2d (endTime-beginTime) * 1e-9)
+reportTime :: (<e> a) -> <e> a
+reportTime f = runProc do
+ beginTime = nanoTime ()
+ result = f
+ endTime = nanoTime ()
+ time = Java.l2d (endTime-beginTime) * 1e-9
+ print "time \(time) s"
+ result
+
"""
Prints the given text and returns
the second parameter.
@Test public void OverloadedArithmetic2() { test(); }
@Test public void OverloadedArithmetic3() { test(); }
@Test public void OverloadedLiterals2() { test(); }
- @Test public void Overloading1() { test(); }
+ @Test public void Overloading1() { test(); }
+ @Test public void Overloading4() { test(); }
@Test public void Parsing() { test(); }
@Test public void PolymorphicRecursion() { test(); }
@Test public void PolymorphicRecursion2() { test(); }
--- /dev/null
+// module M1
+import "Prelude"
+
+foo :: Integer -> Integer -> Integer
+foo = (+)
+--
+// module M2
+import "Prelude"
+
+foo :: String -> String -> String -> <Proc> ()
+foo a b c = do
+ print a
+ print b
+ print c
+--
+import "Prelude"
+import "M1"
+import "M2"
+
+main = ignore (foo "Hello" "world" "!")
+--
+Hello
+world
+!
+()
\ No newline at end of file