From 6407b5f4db68d24454b0fbaaad864727b5c61352 Mon Sep 17 00:00:00 2001 From: Sven/Sarah Barth Date: Fri, 12 Aug 2022 17:19:32 +0200 Subject: [PATCH] * try to specialize a specialize node if it's followed by a < in a non-code section so that we might get better error messages --- compiler/pexpr.pas | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 2804595847..b5ab078b11 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -4816,6 +4816,27 @@ implementation else break; until false; + if (p1.nodetype=specializen) and + (token=_LSHARPBRACKET) and + (m_delphi in current_settings.modeswitches) then + begin + filepos:=current_tokenpos; + consume(token); + p2:=factor(false,[]); + if maybe_handle_specialization(p1,p2,filepos) then + begin + { with p1 now set we are in reality directly behind the + call to "factor" thus we need to call down to that + again } + { This is disabled until specializations on the right + hand side work as well, because + "not working expressions" is better than "half working + expressions" } + {factornode:=p1; + goto SubExprStart;} + end else + message(parser_e_illegal_expression); + end; sub_expr:=p1; end;