Skip to content

Commit 1775052

Browse files
committed
Fix issues after rebase
1 parent 41d3fb4 commit 1775052

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

effekt/shared/src/main/scala/effekt/core/Show.scala

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,8 @@ object Show extends Phase[CoreTransformed, CoreTransformed] {
128128
sys error "targ was not ground type in PureApp"
129129
case Let(id, annotatedTpe, binding, body) => Let(id, annotatedTpe, transform(binding), transform(body))
130130
case Return(expr) => Return(transform(expr))
131-
case o => println(o); ???
132-
}
133-
134-
def transform(pure: Pure)(using ShowContext): Pure = pure match {
135-
case ValueVar(id, annotatedType) => ValueVar(id, annotatedType)
131+
// TODO: We might need to do the same thing as in PureApp if we want to allow show(something) instead of something.show
132+
case ImpureApp(id, callee, targs, vargs, bargs, body) => ImpureApp(id, callee, targs, vargs, bargs, body)
136133
case o => println(o); ???
137134
}
138135

@@ -143,11 +140,9 @@ object Show extends Phase[CoreTransformed, CoreTransformed] {
143140
val targ = targs(0)
144141
if (isGroundType(targ))
145142
val bvar = getOrAddShow(targ)
146-
return Pure.PureApp(bvar, List.empty, vargs)
143+
return Expr.PureApp(bvar, List.empty, vargs)
147144
sys error "targ was not ground type in PureApp"
148145
case PureApp(b, targs, vargs) => PureApp(b, targs, vargs)
149-
// TODO: We might need to do the same thing as in PureApp if we want to allow show(something) instead of something.show
150-
case DirectApp(b, targs, vargs, bargs) => DirectApp(b, targs, vargs, bargs)
151146
case o => println(o); ???
152147
}
153148

@@ -221,15 +216,15 @@ object Show extends Phase[CoreTransformed, CoreTransformed] {
221216
// Literal("Just("), PureApp(show, x), Literal(", "), PureApp(show, y), Literal(")")
222217
// =>
223218
// PureApp(concat, List(Literal("Just("), PureApp(concat, List(PureApp(show, x), PureApp(concat, List(Literal(", "), ...))))
224-
def concatPure(pures: List[Pure])(using ctx: ShowContext): Pure = pures match
219+
def concatPure(pures: List[Expr])(using ctx: ShowContext): Expr = pures match
225220
case head :: next :: rest => PureApp(ctx.infixConcatFn, List.empty, List(head, PureApp(ctx.infixConcatFn, List.empty, List(Literal(", ", TString), concatPure(next :: rest)))))
226221
case head :: Nil => PureApp(ctx.infixConcatFn, List.empty, List(head, Literal(")", TString)))
227222
case Nil => Literal(")", TString)
228223

229-
def fieldValueVar(field: Field): Pure = field match
224+
def fieldValueVar(field: Field): Expr = field match
230225
case Field(id, tpe) => ValueVar(id, tpe)
231226

232-
def fieldPure(field: Field)(using ctx: ShowContext): Pure = field match
227+
def fieldPure(field: Field)(using ctx: ShowContext): Expr.PureApp = field match
233228
case Field(id, tpe) => PureApp(ctx.showDefnsMap(List(tpe)), List.empty, List(ValueVar(id, tpe)))
234229

235230
def getOrAddShow(vt: ValueType)(using ctx: ShowContext): BlockVar = vt match

libraries/common/effekt.effekt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ extern def inspect[R](value: R) at io: Unit =
127127
chez { println(genericShow(value)) }
128128
vm "effekt::inspect(Any)"
129129

130-
extern pure def myshow[R](value: R): String =
130+
extern def myshow[R](value: R): String =
131131
js "$effekt.show(${value})"
132132
chez "(show_impl ${value})"
133133
llvm "; Dummy"

0 commit comments

Comments
 (0)