diff --git a/engine/runtime-compiler/src/main/scala/org/enso/compiler/pass/desugar/ComplexType.scala b/engine/runtime-compiler/src/main/scala/org/enso/compiler/pass/desugar/ComplexType.scala index f29e8f4155..2857183c6b 100644 --- a/engine/runtime-compiler/src/main/scala/org/enso/compiler/pass/desugar/ComplexType.scala +++ b/engine/runtime-compiler/src/main/scala/org/enso/compiler/pass/desugar/ComplexType.scala @@ -26,7 +26,7 @@ import org.enso.compiler.pass.analyse.{ TailCall } import org.enso.compiler.pass.lint.UnusedBindings -import org.enso.compiler.pass.optimise.{LambdaConsolidate} +import org.enso.compiler.pass.optimise.LambdaConsolidate import org.enso.compiler.pass.resolve.{ DocumentationComments, IgnoredBindings, @@ -125,6 +125,7 @@ case object ComplexType extends IRPass { lastAnnotations = Seq() res case _ => + lastAnnotations = Seq() None } // TODO[MK] this is probably removable diff --git a/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/desugar/ComplexTypeTest.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/desugar/ComplexTypeTest.scala index f0e50df5bf..6bf6f66046 100644 --- a/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/desugar/ComplexTypeTest.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/desugar/ComplexTypeTest.scala @@ -86,6 +86,28 @@ class ComplexTypeTest extends CompilerTest { tp.members(1).name.name shouldEqual "Bar" } + "have their annotations correct" in { + val ir = + """ + |type MyType + | @a 42 + | bar self = self + | + | Foo + |""".stripMargin.preprocessModule.desugar + ir.bindings.length shouldEqual 3 + + val tp = ir.bindings(0).asInstanceOf[Definition.Type] + tp.name.name shouldEqual "MyType" + tp.members(0).name.name shouldEqual "Foo" + + val a = ir.bindings(1).asInstanceOf[Name.GenericAnnotation] + a.name shouldEqual "a" + + val bar = ir.bindings(2).asInstanceOf[definition.Method.Binding] + bar.methodName.name shouldEqual "bar" + } + "have their methods desugared to binding methods" in { ir.bindings(3) shouldBe an[definition.Method.Binding] val isJust = ir.bindings(3).asInstanceOf[definition.Method.Binding]