* IncompatibleTypes() added that will include unit names when

the typenames are the same
This commit is contained in:
peter 2003-10-21 18:16:13 +00:00
parent 925046ad5f
commit a28d911c98
8 changed files with 75 additions and 23 deletions

View File

@ -426,7 +426,7 @@ implementation
operpd:=overloaded_operators[optoken].search_procdef_binary_operator(ld,rd);
if not assigned(operpd) then
begin
CGMessage2(type_e_incompatible_types,ld.typename,rd.typename);
IncompatibleTypes(ld,rd);
isbinaryoverloaded:=false;
exit;
end;
@ -941,7 +941,11 @@ implementation
end.
{
$Log$
Revision 1.70 2003-10-20 19:29:12 peter
Revision 1.71 2003-10-21 18:16:13 peter
* IncompatibleTypes() added that will include unit names when
the typenames are the same
Revision 1.70 2003/10/20 19:29:12 peter
* fix check for typecasting wrong sizes in assignment left
Revision 1.69 2003/10/08 19:19:45 peter

View File

@ -272,7 +272,7 @@ implementation
is_voidpointer(ld) then
inserttypeconv(left,right.resulttype)
else if not(equal_defs(ld,rd)) then
CGMessage2(type_e_incompatible_types,ld.typename,rd.typename);
IncompatibleTypes(ld,rd);
end
else if (ld.deftype=enumdef) and (rd.deftype=enumdef) then
begin
@ -911,7 +911,7 @@ implementation
else if is_voidpointer(left.resulttype.def) then
inserttypeconv(left,right.resulttype)
else if not(equal_defs(ld,rd)) then
CGMessage2(type_e_incompatible_types,ld.typename,rd.typename);
IncompatibleTypes(ld,rd);
end;
ltn,lten,gtn,gten:
begin
@ -922,7 +922,7 @@ implementation
else if is_voidpointer(left.resulttype.def) then
inserttypeconv(left,right.resulttype)
else if not(equal_defs(ld,rd)) then
CGMessage2(type_e_incompatible_types,ld.typename,rd.typename);
IncompatibleTypes(ld,rd);
end
else
CGMessage(type_e_mismatch);
@ -936,7 +936,7 @@ implementation
else if is_voidpointer(left.resulttype.def) then
inserttypeconv(left,right.resulttype)
else if not(equal_defs(ld,rd)) then
CGMessage2(type_e_incompatible_types,ld.typename,rd.typename);
IncompatibleTypes(ld,rd);
end
else
CGMessage(type_e_mismatch);
@ -952,7 +952,7 @@ implementation
else if is_voidpointer(left.resulttype.def) then
inserttypeconv(left,right.resulttype)
else if not(equal_defs(ld,rd)) then
CGMessage2(type_e_incompatible_types,ld.typename,rd.typename);
IncompatibleTypes(ld,rd);
end
else
CGMessage(type_e_mismatch);
@ -1875,7 +1875,11 @@ begin
end.
{
$Log$
Revision 1.97 2003-10-08 19:19:45 peter
Revision 1.98 2003-10-21 18:16:13 peter
* IncompatibleTypes() added that will include unit names when
the typenames are the same
Revision 1.97 2003/10/08 19:19:45 peter
* set_varstate cleanup
Revision 1.96 2003/10/01 20:34:48 peter

View File

@ -1152,7 +1152,7 @@ implementation
the procvar, is compatible with the procvar's type }
if proc_to_procvar_equal(tprocsym(tloadnode(left).symtableentry).first_procdef,
tprocvardef(resulttype.def),true)=te_incompatible then
CGMessage2(type_e_incompatible_types,tprocsym(tloadnode(left).symtableentry).first_procdef.typename,resulttype.def.typename);
IncompatibleTypes(tprocsym(tloadnode(left).symtableentry).first_procdef,resulttype.def);
exit;
end;
end
@ -1195,7 +1195,7 @@ implementation
the procvar, is compatible with the procvar's type }
if proc_to_procvar_equal(currprocdef,
tprocvardef(resulttype.def),true)=te_incompatible then
CGMessage2(type_e_incompatible_types,tprocdef(left.resulttype.def).typename,resulttype.def.typename);
IncompatibleTypes(left.resulttype.def,resulttype.def);
exit;
end;
end;
@ -1256,7 +1256,7 @@ implementation
end;
end
else
CGMessage2(type_e_incompatible_types,left.resulttype.def.typename,resulttype.def.typename);
IncompatibleTypes(left.resulttype.def,resulttype.def);
end;
else
@ -2103,7 +2103,11 @@ begin
end.
{
$Log$
Revision 1.123 2003-10-09 14:39:03 peter
Revision 1.124 2003-10-21 18:16:13 peter
* IncompatibleTypes() added that will include unit names when
the typenames are the same
Revision 1.123 2003/10/09 14:39:03 peter
* allow explicit typecasts from classrefdef, fixes 2728
Revision 1.122 2003/10/08 19:19:45 peter

View File

@ -339,7 +339,7 @@ implementation
hp3:=tprocsym(tloadnode(left).symtableentry).search_procdef_byprocvardef(getprocvardef);
if not assigned(hp3) then
begin
CGMessage2(type_e_incompatible_types,tprocsym(tloadnode(left).symtableentry).first_procdef.typename,getprocvardef.typename);
IncompatibleTypes(tprocsym(tloadnode(left).symtableentry).first_procdef,getprocvardef);
exit;
end;
end
@ -904,7 +904,11 @@ begin
end.
{
$Log$
Revision 1.65 2003-10-08 19:19:45 peter
Revision 1.66 2003-10-21 18:16:13 peter
* IncompatibleTypes() added that will include unit names when
the typenames are the same
Revision 1.65 2003/10/08 19:19:45 peter
* set_varstate cleanup
Revision 1.64 2003/10/01 20:34:49 peter

View File

@ -406,7 +406,7 @@ implementation
Message(parser_e_ill_property_access_sym);
end
else
CGMessage2(type_e_incompatible_types,def.typename,p.proptype.def.typename);
IncompatibleTypes(def,p.proptype.def);
end;
else
Message(parser_e_ill_property_access_sym);
@ -450,7 +450,7 @@ implementation
Message(parser_e_ill_property_access_sym);
end
else
CGMessage2(type_e_incompatible_types,def.typename,p.proptype.def.typename);
IncompatibleTypes(def,p.proptype.def);
end;
else
Message(parser_e_ill_property_access_sym);
@ -1158,7 +1158,11 @@ implementation
end.
{
$Log$
Revision 1.69 2003-10-07 16:06:30 peter
Revision 1.70 2003-10-21 18:16:13 peter
* IncompatibleTypes() added that will include unit names when
the typenames are the same
Revision 1.69 2003/10/07 16:06:30 peter
* tsymlist.def renamed to tsymlist.procdef
* tsymlist.procdef is now only used to store the procdef

View File

@ -43,7 +43,8 @@ implementation
{$endif Delphi}
globtype,systems,tokens,verbose,
cutils,globals,widestr,scanner,
symconst,symbase,symdef,aasmbase,aasmtai,aasmcpu,defutil,defcmp,
symconst,symbase,symdef,symtable,
aasmbase,aasmtai,aasmcpu,defutil,defcmp,
{ pass 1 }
node,
nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,
@ -487,7 +488,7 @@ implementation
end;
end
else
Message2(type_e_incompatible_types,t.def.typename,p.resulttype.def.typename);
IncompatibleTypes(t.def,p.resulttype.def);
end
else
Message(cg_e_illegal_expression);
@ -993,7 +994,11 @@ implementation
end.
{
$Log$
Revision 1.71 2003-09-23 17:56:06 peter
Revision 1.72 2003-10-21 18:16:13 peter
* IncompatibleTypes() added that will include unit names when
the typenames are the same
Revision 1.71 2003/09/23 17:56:06 peter
* locals and paras are allocated in the code generation
* tvarsym.localloc contains the location of para/local when
generating code for the current procedure

View File

@ -498,7 +498,7 @@ implementation
equal_defs(p.resulttype.def,aktenumdef) then
v:=tordconstnode(p).value
else
Message2(type_e_incompatible_types,p.resulttype.def.typename,s32bittype.def.typename);
IncompatibleTypes(p.resulttype.def,s32bittype.def);
end
else
Message(cg_e_illegal_expression);
@ -643,7 +643,11 @@ implementation
end.
{
$Log$
Revision 1.59 2003-10-03 14:45:09 peter
Revision 1.60 2003-10-21 18:16:13 peter
* IncompatibleTypes() added that will include unit names when
the typenames are the same
Revision 1.59 2003/10/03 14:45:09 peter
* more proc directive for procvar fixes
Revision 1.58 2003/10/02 21:13:09 peter

View File

@ -196,6 +196,7 @@ interface
procedure globaldef(const s : string;var t:ttype);
function findunitsymtable(st:tsymtable):tsymtable;
procedure duplicatesym(sym:tsym);
procedure incompatibletypes(def1,def2:tdef);
{*** Search ***}
function searchsym(const s : stringid;var srsym:tsym;var srsymtable:tsymtable):boolean;
@ -1765,6 +1766,24 @@ implementation
end;
procedure incompatibletypes(def1,def2:tdef);
var
s1,s2 : string;
begin
s1:=def1.typename;
s2:=def2.typename;
{ When the names are the same try to include the unit name }
if upper(s1)=upper(s2) then
begin
if (def1.owner.symtabletype in [globalsymtable,staticsymtable]) then
s1:=def1.owner.realname^+'.'+s1;
if (def2.owner.symtabletype in [globalsymtable,staticsymtable]) then
s2:=def2.owner.realname^+'.'+s2;
end;
CGMessage2(type_e_incompatible_types,s1,s2);
end;
{*****************************************************************************
Search
*****************************************************************************}
@ -2293,7 +2312,11 @@ implementation
end.
{
$Log$
Revision 1.116 2003-10-17 14:38:32 peter
Revision 1.117 2003-10-21 18:16:13 peter
* IncompatibleTypes() added that will include unit names when
the typenames are the same
Revision 1.116 2003/10/17 14:38:32 peter
* 64k registers supported
* fixed some memory leaks