mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 09:09:19 +02:00
Fix for Mantis #25915.
* ptype.pas, id_type: generate the "identifier not found" message only if the identifier was really not found and not when the identifier is a non-type * pexpr.pas, statement_syssym: don't generate the "type id expected" error message for Default() anymore; this is already handled by single_type + added test (though this again will not help much as output is not parsed...) git-svn-id: trunk@27464 -
This commit is contained in:
parent
689996d84f
commit
b9a59c33f4
@ -877,9 +877,8 @@ implementation
|
|||||||
def:=nil;
|
def:=nil;
|
||||||
single_type(def,[stoAllowSpecialization]);
|
single_type(def,[stoAllowSpecialization]);
|
||||||
statement_syssym:=cerrornode.create;
|
statement_syssym:=cerrornode.create;
|
||||||
if def=generrordef then
|
if def<>generrordef then
|
||||||
Message(type_e_type_id_expected)
|
{ "type expected" error is already done by single_type }
|
||||||
else
|
|
||||||
if def.typ=forwarddef then
|
if def.typ=forwarddef then
|
||||||
Message1(type_e_type_is_not_completly_defined,tforwarddef(def).tosymname^)
|
Message1(type_e_type_is_not_completly_defined,tforwarddef(def).tosymname^)
|
||||||
else
|
else
|
||||||
|
@ -300,7 +300,7 @@ implementation
|
|||||||
{ to a appropriating tdef, s gets the name of }
|
{ to a appropriating tdef, s gets the name of }
|
||||||
{ the type to allow name mangling }
|
{ the type to allow name mangling }
|
||||||
var
|
var
|
||||||
is_unit_specific : boolean;
|
is_unit_specific,not_a_type : boolean;
|
||||||
pos : tfileposinfo;
|
pos : tfileposinfo;
|
||||||
s,sorg : TIDString;
|
s,sorg : TIDString;
|
||||||
t : ttoken;
|
t : ttoken;
|
||||||
@ -316,10 +316,21 @@ implementation
|
|||||||
try_parse_structdef_nested_type(def,current_structdef,isforwarddef) then
|
try_parse_structdef_nested_type(def,current_structdef,isforwarddef) then
|
||||||
exit;
|
exit;
|
||||||
{ Use the special searchsym_type that search only types }
|
{ Use the special searchsym_type that search only types }
|
||||||
searchsym_type(s,srsym,srsymtable);
|
if not searchsym_type(s,srsym,srsymtable) then
|
||||||
|
{ for a good error message we need to know whether the symbol really did not exist or
|
||||||
|
whether we found a non-type one }
|
||||||
|
not_a_type:=searchsym(s,srsym,srsymtable)
|
||||||
|
else
|
||||||
|
not_a_type:=false;
|
||||||
{ handle unit specification like System.Writeln }
|
{ handle unit specification like System.Writeln }
|
||||||
is_unit_specific:=try_consume_unitsym(srsym,srsymtable,t,true);
|
is_unit_specific:=try_consume_unitsym(srsym,srsymtable,t,true);
|
||||||
consume(t);
|
consume(t);
|
||||||
|
if not_a_type then
|
||||||
|
begin
|
||||||
|
{ reset the symbol and symtable to not leak any unexpected values }
|
||||||
|
srsym:=nil;
|
||||||
|
srsymtable:=nil;
|
||||||
|
end;
|
||||||
{ Types are first defined with an error def before assigning
|
{ Types are first defined with an error def before assigning
|
||||||
the real type so check if it's an errordef. if so then
|
the real type so check if it's an errordef. if so then
|
||||||
give an error. Only check for typesyms in the current symbol
|
give an error. Only check for typesyms in the current symbol
|
||||||
@ -343,14 +354,14 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{ unknown sym ? }
|
{ unknown sym ? }
|
||||||
if not assigned(srsym) then
|
if not assigned(srsym) and not not_a_type then
|
||||||
begin
|
begin
|
||||||
Message1(sym_e_id_not_found,sorg);
|
Message1(sym_e_id_not_found,sorg);
|
||||||
def:=generrordef;
|
def:=generrordef;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{ type sym ? }
|
{ type sym ? }
|
||||||
if (srsym.typ<>typesym) then
|
if not_a_type or (srsym.typ<>typesym) then
|
||||||
begin
|
begin
|
||||||
Message(type_e_type_id_expected);
|
Message(type_e_type_id_expected);
|
||||||
def:=generrordef;
|
def:=generrordef;
|
||||||
|
Loading…
Reference in New Issue
Block a user