Skip to content

Commit d0959c8

Browse files
committed
Remove basePath.contains
1 parent ae50960 commit d0959c8

File tree

12 files changed

+50
-42
lines changed

12 files changed

+50
-42
lines changed

compiler/shared/test/diff/Lifter/FunctionTypeAnnotations.mls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
:NewDefs
22
:ParseOnly
33

4+
:lift
45
fun foo(x) =
56
(y) => x+y
67
foo(1)(2)

compiler/shared/test/diff/Lifter/LambLift.mls

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
:NewDefs
22
:ParseOnly
33

4+
:lift
45
fun foo() =
56
let local(x) =
67
class Foo {
@@ -20,6 +21,7 @@ foo()
2021
//│ }
2122
//│
2223

24+
:lift
2325
fun foo(f) =
2426
f(1)
2527
foo(x => x+1)
@@ -33,6 +35,7 @@ foo(x => x+1)
3335
//│ }
3436
//│
3537

38+
:lift
3639
fun foo(x) =
3740
let bar(f) =
3841
f(x)
@@ -49,6 +52,7 @@ foo(1)
4952
//│ }
5053
//│
5154

55+
:lift
5256
fun foo(f) =
5357
f(1)
5458
class A(y: Int){

compiler/shared/test/diff/Lifter/LiftNew.mls

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
class A(num: Int) {
55
}
66
new A(5)
7-
//│ TypingUnit {
8-
//│ class A([num: Int,]) {}
9-
//│ Code(List((new A)(5,)))
10-
//│ }
117
//│ Lifted:
128
//│ TypingUnit {
139
//│ class A$1([num: Int,]) {}

compiler/shared/test/diff/Lifter/LiftType.mls

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
:NewDefs
22
:ParseOnly
33

4+
:lift
45
class CTX{
56
class A {}
67
fun foo(f: A => A): (A => A) => A = f(new A)
@@ -16,6 +17,7 @@ class CTX{
1617
//│ }
1718
//│
1819

20+
:lift
1921
class CTX(x, y){
2022
class A{ fun foo = x}
2123
class B: A { fun foo = y}
@@ -33,6 +35,7 @@ class CTX(x, y){
3335
//│ }
3436
//│
3537

38+
:lift
3639
class CTX(x, y){
3740
class A{ fun foo = x}
3841
class B: A { fun foo = y}
@@ -50,6 +53,7 @@ class CTX(x, y){
5053
//│ }
5154
//│
5255

56+
:lift
5357
class CTX(x, y){
5458
class A{ fun foo = x}
5559
class B<T> { fun foo = y}
@@ -67,6 +71,7 @@ class CTX(x, y){
6771
//│ }
6872
//│
6973

74+
:lift
7075
class CTX{
7176
fun ctx(x,y) =
7277
class A{ fun foo = x }

compiler/shared/test/diff/Lifter/Lifter.mls

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
:NewDefs
22
:ParseOnly
33

4+
:lift
45
class A(x) {
56
class B(y) {
67
fun getX = x
@@ -56,6 +57,7 @@ class A(x) {
5657
//│ }
5758
//│
5859

60+
:lift
5961
class A(x) {
6062
class B(y) {
6163
class C(z) {
@@ -75,7 +77,7 @@ class A(x) {
7577
//│ }
7678
//│
7779

78-
80+
:lift
7981
class A(x) {
8082
class B{
8183
fun foo = 1
@@ -108,7 +110,7 @@ new C{
108110
//│
109111

110112

111-
113+
:lift
112114
class Parent<T, U, V>(x) {
113115
fun foo(x: Int): T = x+1
114116
class Inner<W>(y: Int){
@@ -128,7 +130,7 @@ class Parent<T, U, V>(x) {
128130
//│ }
129131
//│
130132

131-
133+
:lift
132134
class B<T> {}
133135
class C {}
134136
class D(y: Int) {}
@@ -149,6 +151,7 @@ class A<T, U>(x: Int): ({a1: Int} & B<T> & D(x)) {
149151
//│
150152
// │ TypingUnit(NuTypeDef(class, B, (TypeName(T)), Tup(), (), TypingUnit()), NuTypeDef(class, C, (), Tup(), (), TypingUnit()), NuTypeDef(class, A, (TypeName(T), TypeName(U)), Tup(x: Var(Int)), (App(App(Var(&), Tup(_: Bra(rcd = true, Rcd(Var(a1) = Var(Int)})))), Tup(_: TyApp(Var(B), List(TypeName(T)))))), TypingUnit(NuFunDef(None, getA, [], Lam(Tup(), New(Some((TypeName(C),)), TypingUnit(List(fun foo = x: T, => x))))))))
151153

154+
:lift
152155
class B<T> {}
153156
class C {}
154157
class D(y: Int) {}
@@ -168,6 +171,7 @@ class A<T, U>(x: Int) extends {a1: Int}, B<T>, D(x){
168171
//│ }
169172
//│
170173

174+
:lift
171175
class Child<T, U>(x): ({ age: T } & { name: String}) {
172176
class Inner{
173177
fun foo = age
@@ -187,7 +191,7 @@ class Child<T, U>(x): ({ age: T } & { name: String}) {
187191
//│ }
188192
//│
189193

190-
194+
:lift
191195
class A(x: Int) {
192196
fun getA: Int = 0
193197
fun getA1 = 1
@@ -206,7 +210,7 @@ new A(0) {
206210
//│ }
207211
//│
208212

209-
213+
:lift
210214
class A(x) {
211215
class B(y) { }
212216
}
@@ -228,7 +232,7 @@ new A(1) {
228232
//│
229233

230234

231-
235+
:lift
232236
class A {
233237
fun getA = 0
234238
fun funcA = 10
@@ -260,7 +264,7 @@ new B{
260264
//│ }
261265
//│
262266

263-
267+
:lift
264268
class A{
265269
class B{
266270
fun funB = 1
@@ -296,7 +300,7 @@ class A{
296300
//│ }
297301
//│
298302

299-
303+
:lift
300304
class A{
301305
class B{
302306
fun funB = 1
@@ -349,7 +353,7 @@ class A{
349353
//│ }
350354
//│
351355

352-
356+
:lift
353357
class A{
354358
class B{
355359
fun foo = 1
@@ -367,7 +371,7 @@ new A
367371
//│ }
368372
//│
369373

370-
374+
:lift
371375
class A(x) {
372376
fun foo = 0
373377
fun bar = x
@@ -389,6 +393,7 @@ let x = new A{
389393
//│ }
390394
//│
391395

396+
:lift
392397
class A {}
393398
new A{
394399
fun foo = 1

compiler/shared/test/diff/Lifter/LifterBlks.mls

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
:NewDefs
22
:ParseOnly
33

4+
:lift
45
fun foo =
56
print("ok")
67
print("ko")
@@ -10,6 +11,7 @@ fun foo =
1011
//│ TypingUnit {fun foo$1 = {print("ok",); print("ko",)}}
1112
//│
1213

14+
:lift
1315
class A{
1416
class B {}
1517
fun foo(x: B) = (x : B)
@@ -23,6 +25,7 @@ class A{
2325
//│ }
2426
//│
2527

28+
:lift
2629
fun foo =
2730
let local(x) =
2831
class Foo {
@@ -45,6 +48,7 @@ fun foo =
4548
//│ }
4649
//│
4750

51+
:lift
4852
class A(y){}
4953
let f = x => new A(0){fun bar = x+y}
5054
f(0)
@@ -59,6 +63,7 @@ f(0)
5963
//│ }
6064
//│
6165

66+
:lift
6267
class A(x){
6368
fun w = x
6469
fun foo(y) =
@@ -82,6 +87,7 @@ class A(x){
8287
//│ }
8388
//│
8489

90+
:lift
8591
fun f(x,y,z) =
8692
class A{
8793
fun foo = new B
@@ -111,6 +117,7 @@ fun f(x,y,z) =
111117
//│ }
112118
//│
113119

120+
:lift
114121
fun f(x,y,z) =
115122
class C{
116123
class A{
@@ -142,33 +149,25 @@ fun f(x,y,z) =
142149
//│ }
143150
//│
144151

152+
:lift
145153
fun f(y) =
146154
let g(x) = x + y + 1
147155
class Foo(x) {
148156
fun h = g(x)
149157
}
150-
//│ |#fun| |f|(|y|)| |#=|→|#let| |g|(|x|)| |#=| |x| |+| |y| |+| |1|↵|#class| |Foo|(|x|)| |{|→|#fun| |h| |#=| |g|(|x|)|←|↵|}|←|
151-
//│ Parsed: {fun f = (y,) => {let g = (x,) => +(+(x, y,), 1,); class Foo(x,) {fun h = g(x,)}}}
158+
Foo(1).h
159+
Foo(x).h
160+
//│ |#fun| |f|(|y|)| |#=|→|#let| |g|(|x|)| |#=| |x| |+| |y| |+| |1|↵|#class| |Foo|(|x|)| |{|→|#fun| |h| |#=| |g|(|x|)|←|↵|}|↵|Foo|(|1|)|.h| |↵|Foo|(|x|)|.h|←|
161+
//│ Parsed: {fun f = (y,) => {let g = (x,) => +(+(x, y,), 1,); class Foo(x,) {fun h = g(x,)}; (Foo(1,)).h; (Foo(x,)).h}}
152162
//│ Lifted:
153163
//│ TypingUnit {
154164
//│ class Foo$1([x, y,]) {fun h = g$2((this).x, y,)}
155165
//│ let g$2 = (x, y,) => +(+(x, y,), 1,)
156-
//│ fun f$1 = (y,) => {}
166+
//│ fun f$1 = (y,) => {(Foo$1(1, y,)).h; (Foo$1(x, y,)).h}
157167
//│ }
158-
//│
159-
Foo(1).h
160-
//│ | |Foo|(|1|)|.h|
161-
//│ Parsed: {(Foo(1,)).h}
162-
//│ Lifted:
163-
//│ TypingUnit {Code(List((Foo(1,)).h))}
164-
//│
165-
Foo(x).h
166-
//│ | |Foo|(|x|)|.h|
167-
//│ Parsed: {(Foo(x,)).h}
168-
//│ Lifted:
169-
//│ TypingUnit {Code(List((Foo(x,)).h))}
170168
//│
171169

170+
:lift
172171
fun f(x) =
173172
let g(x) =
174173
let h(x) = x + 2
@@ -188,6 +187,7 @@ fun f(x) =
188187
//│ }
189188
//│
190189

190+
:lift
191191
class Foo(x, y) extends Bar(y, x), Baz(x + y)
192192
//│ |#class| |Foo|(|x|,| |y|)| |#extends| |Bar|(|y|,| |x|)|,| |Baz|(|x| |+| |y|)|
193193
//│ Parsed: {class Foo(x, y,): Bar(y, x,), Baz(+(x, y,),) {}}
@@ -197,6 +197,7 @@ class Foo(x, y) extends Bar(y, x), Baz(x + y)
197197
//│ }
198198
//│
199199

200+
:lift
200201
fun foo<T, U>(x: T): string =
201202
class A(y) extends B<T>, C(y: U) {
202203
fun bar = this
@@ -211,6 +212,7 @@ fun foo<T, U>(x: T): string =
211212
//│ }
212213
//│
213214

215+
:lift
214216
class A<T>{
215217
class B{
216218
fun f = x => y => x
@@ -230,6 +232,7 @@ class A<T>{
230232
//│ }
231233
//│
232234

235+
:lift
233236
class Foo<T>{
234237
class RectangleBox: Box<T> & { breadth: T }
235238
class StackedRectangleBoxes<N> : RectangleBox<T> & { size: N }
@@ -246,6 +249,7 @@ class Foo<T>{
246249
//│ }
247250
//│
248251

252+
:lift
249253
class Func<T, U> {
250254
fun apply: T => U
251255
}
@@ -267,6 +271,7 @@ fun ctx(a,b) =
267271
//│ }
268272
//│
269273

274+
:lift
270275
fun f(T) =
271276
new T()
272277
f(MyClass)
@@ -276,6 +281,7 @@ f(MyClass)
276281
//│ Lifting failed: mlscript.codegen.CodeGenError: Cannot find type T. Class values are not supported in lifter.
277282
//│
278283

284+
:lift
279285
class A {
280286
fun foo =
281287
fun bar = foo()

compiler/shared/test/diff/Lifter/NestedClasses.mls

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ class X() {
66
class Y() {}
77
}
88
X.Y()
9-
//│ TypingUnit {
10-
//│ class X([]) {class Y([]) {}}
11-
//│ Code(List((X).Y()))
12-
//│ }
139
//│ Lifted:
1410
//│ TypingUnit {
1511
//│ class X$1_Y$2([par$X$1,]) {}

compiler/shared/test/diff/Lifter/NestedFuncs.mls

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ fun test(a) =
66
let f(x) = a + x
77
f
88
test(6)(4)
9-
//│ TypingUnit {
10-
//│ fun test = (a,) => {let f = (x,) => +(a, x,); f}
11-
//│ Code(List(test(6,)(4,)))
12-
//│ }
139
//│ Lifted:
1410
//│ TypingUnit {
1511
//│ let f$2 = (x, a,) => +(a, x,)

0 commit comments

Comments
 (0)