use of ast.Ast.MethodType in project L42 by ElvisResearchGroup.
the class Test212_or_170_MethodTypes method testMI.
@Test
public void testMI() {
int count = 0;
for (MethodType mt : dataSet) {
MethodType base = mBase(mt);
//mC(mNoFwd(mBase))
MethodType res = _mI(mNoFwd(base));
if (mNoFwd(base).equals(base)) {
continue;
}
if (res == null) {
continue;
}
count += 1;
}
//mI need read to start. read return prevents fwd parameters
assert count == 0;
System.out.println(count);
}
use of ast.Ast.MethodType in project L42 by ElvisResearchGroup.
the class Test212_or_170_MethodTypes method testMvpNoFwdSwap.
@Test
public void testMvpNoFwdSwap() {
int countA = 0;
int countB = 0;
for (MethodType mt : dataSet) {
MethodType base = mBase(mt);
//test mVp(mNoFwd(mBase)) == mNoFwd(mVp(mBase))
{
MethodType v1 = _mVp(mNoFwd(base), 1);
MethodType v2 = _mVp(base, 1);
if (v2 != null) {
v2 = mNoFwd(v2);
}
//v2 ok implies v1 ok
assert v2 == null || v1 != null;
//not assert v1==null ||v2!=null;//v1 ok imples v2 ok
assert v2 == null || v1.equals(v2) : mtToS(v1) + " " + mtToS(v2);
if (v1 != null && v2 != null) {
countA += 1;
}
}
{
MethodType v1 = _mVp(mNoFwd(base), 2);
MethodType v2 = _mVp(base, 2);
if (v2 != null) {
v2 = mNoFwd(v2);
}
//v2 ok implies v1 ok
assert v2 == null || v1 != null;
//not assert v1==null ||v2!=null;//v1 ok imples v2 ok
assert v2 == null || v1.equals(v2) : mtToS(v1) + " " + mtToS(v2);
if (v1 != null && v2 != null) {
countB += 1;
}
}
}
System.out.println(countA);
System.out.println(countB);
}
use of ast.Ast.MethodType in project L42 by ElvisResearchGroup.
the class Test212_or_170_MethodTypes method recLeft.
MethodType recLeft(MethodType mt) {
List<Type> newTs = mt.getTs().subList(1, mt.getTs().size());
Mdf mdf = mt.getTs().get(0).getMdf();
if (TypeManipulation.fwd_or_fwdP_in(mdf)) {
return null;
}
return mt.withMdf(mdf).withTs(newTs);
}
use of ast.Ast.MethodType in project L42 by ElvisResearchGroup.
the class Test212_or_170_MethodTypes method test1.
@Test
public void test1() {
assert dataSet.size() == 170 : dataSet.size();
//Lent,ImmutableFwd->ImmutablePFwd
Type _t = Path.Any().toImmNT();
MethodType proto = new MethodType(true, Mdf.Capsule, Arrays.asList(_t.withMdf(Mdf.Mutable), _t.withMdf(Mdf.ImmutableFwd)), _t.withMdf(Mdf.ImmutablePFwd), Collections.emptyList());
proto = _mVp(proto, 1);
System.out.println(mtToS(proto));
}
use of ast.Ast.MethodType in project L42 by ElvisResearchGroup.
the class Test212_or_170_MethodTypes method checkOne.
void checkOne(MethodType mt0, MethodType mt1) {
List<MethodType> list0 = AlternativeMethodTypes.types(mt0);
List<MethodType> list1 = AlternativeMethodTypes.types(mt1);
for (MethodType mt1i : list1) {
assert list0.stream().anyMatch(mt0i -> TypeSystem._methMdfTSubtype(mt0i, mt1i)) : "\n" + mtToS(mt0) + "\n" + mtToS(mt1) + "\n" + mtToS(mt1i) + "\n" + mtsToS(list0);
}
}
Aggregations