From ba20326c09b3e03b191dc0d5c100b9e2dfde9195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Mon, 16 Dec 2024 12:27:46 +0100 Subject: [PATCH] Add spec --- spec/compiler/semantic/macro_spec.cr | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/compiler/semantic/macro_spec.cr b/spec/compiler/semantic/macro_spec.cr index c66ee3d902f5..82e396ac6f12 100644 --- a/spec/compiler/semantic/macro_spec.cr +++ b/spec/compiler/semantic/macro_spec.cr @@ -613,6 +613,21 @@ describe "Semantic: macro" do CRYSTAL end + it "being with {{ yield }} (#15050)", focus: true do + result = top_level_semantic <<-CRYSTAL, wants_doc: true + macro foo + {{yield}} + end + + foo do + # doc comment + def test + end + end + CRYSTAL + result.program.defs.try(&.["test"][0].def.doc).should eq "doc comment" + end + it "can return class type in macro def" do assert_type(<<-CRYSTAL) { types["Int32"].metaclass } class Foo