Handle module types properly.

This commit is contained in:
Juraj Kirchheim
2018-01-29 10:12:06 +01:00
parent 40ee99df39
commit 9cd59d3989
2 changed files with 13 additions and 2 deletions

View File

@@ -99,10 +99,16 @@ class Sisyphus {
}
static function toTypePath(baseType : BaseType, params : Array<Type>) : TypePath return {
var module = baseType.module;
var name = module.substring(module.lastIndexOf(".") + 1);
var sub = switch baseType.name {
case _ == name => true: null;
case v: v;
}
{
pack: baseType.pack,
name: module.substring(module.lastIndexOf(".") + 1),
sub: baseType.name,
name: name,
sub: sub,
params: [ for (t in params) TPType(toComplexType(t)) ],
}
}

View File

@@ -44,4 +44,9 @@ class Types extends Base {
MacroApi.pos().makeBlankType().toString();
}
function testToComplex() {
assertEquals('String', Context.getType('String').toComplex().toString());
assertEquals('tink.CoreApi.Noise', Context.getType('tink.CoreApi.Noise').toComplex().toString());
}
}