From 228bb5e737c81986095033ad974f28472bfb1b34 Mon Sep 17 00:00:00 2001 From: Martin Ilgner Date: Sat, 6 Jun 2026 12:35:16 +0200 Subject: [PATCH] Allow DummyUnifier to abort --- .../src/main/scala/effekt/typer/CapabilityScope.scala | 6 ++---- .../shared/src/main/scala/effekt/typer/TypeComparer.scala | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/effekt/shared/src/main/scala/effekt/typer/CapabilityScope.scala b/effekt/shared/src/main/scala/effekt/typer/CapabilityScope.scala index 5aa207aeca..bf71f850c7 100644 --- a/effekt/shared/src/main/scala/effekt/typer/CapabilityScope.scala +++ b/effekt/shared/src/main/scala/effekt/typer/CapabilityScope.scala @@ -42,15 +42,13 @@ object DummyUnifier extends TypeUnifier { override def requireEqual(x: symbols.UnificationVar, tpe: symbols.ValueType, ctx: ErrorContext): Unit = () override def requireSubregion(lower: symbols.Captures, upper: symbols.Captures, ctx: ErrorContext): Unit = () - - // NOTE(jiribenes, 2025-11-12): I think the 'abort' should never be triggered here. - override def abort(msg: String, ctx: ErrorContext): Nothing = sys error "Unexpected abort in DummyUnifier!" + override def abort(msg: String, ctx: ErrorContext): Nothing = throw UnificationFailed override def error(msg: String, ctx: ErrorContext): Unit = throw UnificationFailed override def error(left: symbols.Type, right: symbols.Type, ctx: ErrorContext): Unit = throw UnificationFailed } -class BindSome(binder: source.Tree, capabilities: Map[symbols.InterfaceType, symbols.BlockParam],val parent: CapabilityScope) extends CapabilityScope { +class BindSome(binder: source.Tree, capabilities: Map[symbols.InterfaceType, symbols.BlockParam], val parent: CapabilityScope) extends CapabilityScope { def copy: CapabilityScope = BindSome(binder, capabilities, parent.copy) def capabilityFor(tpe: symbols.InterfaceType)(using C: Context): symbols.BlockParam = capabilities.get(tpe).orElse { diff --git a/effekt/shared/src/main/scala/effekt/typer/TypeComparer.scala b/effekt/shared/src/main/scala/effekt/typer/TypeComparer.scala index cca4840086..582c244c7d 100644 --- a/effekt/shared/src/main/scala/effekt/typer/TypeComparer.scala +++ b/effekt/shared/src/main/scala/effekt/typer/TypeComparer.scala @@ -56,7 +56,7 @@ trait TypeUnifier { // TODO here we assume that the type constructor is covariant (args1 zip args2) foreach { case (t1, t2) => unifyValueTypes(t1, t2, ErrorContext.TypeConstructorArgument(ctx)) } - case (t @ BoxedType(tpe1, capt1), s @ BoxedType(tpe2, capt2), p, _) => + case (t @ BoxedType(tpe1, capt1), s @ BoxedType(tpe2, capt2), _, _) => unifyBlockTypes(tpe1, tpe2, ErrorContext.BoxedTypeBlock(t, s, ctx)) unifyCaptures(capt1, capt2, ErrorContext.BoxedTypeCapture(t, s, ctx))