From d519f79703b998e7b5af65fe10c047403a698826 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Mon, 29 Jun 2026 15:37:45 +0100 Subject: [PATCH] Update ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll Co-authored-by: Tom Hvitved --- .../test/internal/InlineExpectationsTestImpl.qll | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index 01c73f26a39..bd84f530f9c 100644 --- a/ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -12,22 +12,26 @@ module Impl implements InlineExpectationsTestSig { * A class representing comments that may contain inline expectations (Ruby line comments and ERB comments). */ class ExpectationComment extends TAnyComment { + Ruby::Comment asRubyComment() { this = RubyComment(result) } + + R::ErbComment asErbComment() { this = ErbComment(result) } + string toString() { - result = any(Ruby::Comment c | this = RubyComment(c)).toString() + result = this.asRubyComment().toString() or - result = any(R::ErbComment c | this = ErbComment(c)).toString() + result = this.asErbComment().toString() } Location getLocation() { - result = any(Ruby::Comment c | this = RubyComment(c)).getLocation() + result = this.asRubyComment().getLocation() or - result = any(R::ErbComment c | this = ErbComment(c)).getLocation() + result = this.asErbComment().getLocation() } string getContents() { - result = any(Ruby::Comment c | this = RubyComment(c)).getValue().suffix(1) + result = this.asRubyComment().getValue().suffix(1) or - result = any(R::ErbComment c | this = ErbComment(c)).getValue().suffix(1) + result = this.asErbComment().getValue().suffix(1) } }