Skip to content

Commit eb562a1

Browse files
author
Guannan Wei
committed
clean up
1 parent 7ee3b79 commit eb562a1

2 files changed

Lines changed: 13 additions & 21 deletions

File tree

src/main/scala/qualfsub/TypeCheck.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,13 @@ def checkSubQType(T: QType, S: QType)(using Γ: TEnv): Unit =
391391
def checkSubtypeOverlap(T: QType, S: QType)(using Γ: TEnv): Unit =
392392
val QType(t1, q1) = T
393393
val QType(t2, q2) = S
394-
if (t1.isSubtype(t2)) {
394+
if (t1.isSubtype(t2))
395395
val sq1 = q1.sat
396396
val sq2 = q2.sat // FIXME: should not compute saturated sat here
397397
if (sq1.isSubqual(sq2)) ()
398398
else throw NonOverlap(sq2 - Fresh(), sq1 \ sq2)
399-
} else throw NotSubtype(t1, t2)()
399+
else
400+
throw NotSubtype(t1, t2)()
400401

401402
def checkDeepDep(t: Type, x: String): Unit =
402403
if (!t.freeVars.contains(x)) ()

src/test/scala/avoidancefsub/TypeCheck.scala

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,16 @@ class AvoidanceFSubTests extends AnyFunSuite {
5555
val p = ${makePair("r1", "r2")}[Ref[Int], Ref[Int]](r1, r2);
5656
p
5757
"""
58-
//${fstT("r1", "p")}[Ref[Int], Ref[Int]]
59-
println(parseToCore(prog1))
60-
assert(parseAndCheck(prog1) == (TRef(TNum^()) ^ ))
61-
val prog2 = s"""
62-
val r1 = Ref 1;
63-
val r2 = Ref 2;
64-
val p = ${makePair("r1", "r2")}[Ref[Int], Ref[Int]];
65-
${sndT("r1", "p")}[Ref[Int], Ref[Int]]
66-
"""
58+
59+
//${fstT("r1", "p")}[Ref[Int], Ref[Int]]
60+
//println(parseToCore(prog1))
61+
//assert(parseAndCheck(prog1) == (TRef(TNum^()) ^ ◆))
62+
//val prog2 = s"""
63+
// val r1 = Ref 1;
64+
// val r2 = Ref 2;
65+
// val p = ${makePair("r1", "r2")}[Ref[Int], Ref[Int]];
66+
// ${sndT("r1", "p")}[Ref[Int], Ref[Int]]
67+
//"""
6768
//println(parseToCore(prog2))
6869
//assert(parseAndCheck(prog2) == (TRef(TNum^()) ^ ◆))
6970
}
@@ -130,13 +131,3 @@ class AvoidanceFSubTests extends AnyFunSuite {
130131
}
131132

132133
}
133-
134-
135-
/*
136-
ELet(r1,None,EAlloc(ENum(1)),ELet(r2,None,EAlloc(ENum(2)),
137-
ELet(p,None,
138-
ETyApp(ETyApp(
139-
ETyLam(𝐹#0,A,𝑥#1,TTop^◆,ETyLam(𝐹#2,B,𝑥#3,TTop^◆,ETyLam(𝐹#4,C,𝑥#5,TTop^◆,ELam(p,f,TFun(f,x,TVar(A)^r1,TFun(g,y,TVar(B)^r2,TVar(C)^g)^f)^{◆,p},EApp(EApp(EVar(f),EVar(r1),None),EVar(r2),None),Some(TVar(C)^f),Some({r1,r2})),None,None),None,None),None,None),
140-
TRef(TNum^∅)^∅,None),
141-
TRef(TNum^∅)^∅,None),EVar(p),false),false),false)
142-
*/

0 commit comments

Comments
 (0)