瀏覽代碼

* resolve formal/anonymous external classes before comparing parameters to
overloaded routines

git-svn-id: trunk@31458 -

Jonas Maebe 10 年之前
父節點
當前提交
c27807ee63
共有 5 個文件被更改,包括 33 次插入5 次删除
  1. 1 0
      .gitattributes
  2. 8 5
      compiler/htypechk.pas
  3. 4 0
      tests/test/jvm/testall.bat
  4. 2 0
      tests/test/jvm/testall.sh
  5. 18 0
      tests/test/jvm/tformalclass.pp

+ 1 - 0
.gitattributes

@@ -11430,6 +11430,7 @@ tests/test/jvm/testall.sh -text svneol=native#application/x-sh
 tests/test/jvm/testansi.pp svneol=native#text/plain
 tests/test/jvm/testansi.pp svneol=native#text/plain
 tests/test/jvm/testintf.pp svneol=native#text/plain
 tests/test/jvm/testintf.pp svneol=native#text/plain
 tests/test/jvm/testshort.pp svneol=native#text/plain
 tests/test/jvm/testshort.pp svneol=native#text/plain
+tests/test/jvm/tformalclass.pp svneol=native#text/plain
 tests/test/jvm/tformalpara.pp svneol=native#text/plain
 tests/test/jvm/tformalpara.pp svneol=native#text/plain
 tests/test/jvm/tinitvar.pp svneol=native#text/plain
 tests/test/jvm/tinitvar.pp svneol=native#text/plain
 tests/test/jvm/tint.pp svneol=native#text/plain
 tests/test/jvm/tint.pp svneol=native#text/plain

+ 8 - 5
compiler/htypechk.pas

@@ -2602,7 +2602,8 @@ implementation
         paraidx  : integer;
         paraidx  : integer;
         currparanr : byte;
         currparanr : byte;
         rfh,rth  : double;
         rfh,rth  : double;
-        objdef   : tobjectdef;
+        obj_from,
+        obj_to   : tobjectdef;
         def_from,
         def_from,
         def_to   : tdef;
         def_to   : tdef;
         currpt,
         currpt,
@@ -2768,13 +2769,15 @@ implementation
                   def_is_related(tobjectdef(def_from),tobjectdef(def_to)) then
                   def_is_related(tobjectdef(def_from),tobjectdef(def_to)) then
                  begin
                  begin
                    eq:=te_convert_l1;
                    eq:=te_convert_l1;
-                   objdef:=tobjectdef(def_from);
-                   while assigned(objdef) do
+                   { resolve anonymous external class definitions }
+                   obj_from:=find_real_class_definition(tobjectdef(def_from),false);
+                   obj_to:=find_real_class_definition(tobjectdef(def_to),false);
+                   while assigned(obj_from) do
                      begin
                      begin
-                       if objdef=def_to then
+                       if obj_from=obj_to then
                          break;
                          break;
                        hp^.ordinal_distance:=hp^.ordinal_distance+1;
                        hp^.ordinal_distance:=hp^.ordinal_distance+1;
-                       objdef:=objdef.childof;
+                       obj_from:=obj_from.childof;
                      end;
                      end;
                  end
                  end
                { compare_defs_ext compares sets and array constructors very poorly because
                { compare_defs_ext compares sets and array constructors very poorly because

+ 4 - 0
tests/test/jvm/testall.bat

@@ -316,3 +316,7 @@ java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. tsetstring
 if %errorlevel% neq 0 exit /b %errorlevel%
 if %errorlevel% neq 0 exit /b %errorlevel%
 ppcjvm -O2 -g -B  -Sa tnestcallpass1
 ppcjvm -O2 -g -B  -Sa tnestcallpass1
 if %errorlevel% neq 0 exit /b %errorlevel%
 if %errorlevel% neq 0 exit /b %errorlevel%
+ppcjvm -O2 -g -B  -CTinitlocals tformalclass
+if %errorlevel% neq 0 exit /b %errorlevel%
+java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. tformalclass
+if %errorlevel% neq 0 exit /b %errorlevel%

+ 2 - 0
tests/test/jvm/testall.sh

@@ -185,3 +185,5 @@ java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. tprop6a
 $PPC -O2 -g -B -Sa tsetstring
 $PPC -O2 -g -B -Sa tsetstring
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. tsetstring
 java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. tsetstring
 $PPC -O2 -g -B -Sa tnestcallpass1
 $PPC -O2 -g -B -Sa tnestcallpass1
+$PPC -O2 -g -B -Sa tformalclass
+java -Dfile.encoding=UTF-8 -cp ../../../rtl/units/$RTLDIR:. tformalclass

+ 18 - 0
tests/test/jvm/tformalclass.pp

@@ -0,0 +1,18 @@
+program tformalclass;
+
+{$macro on}
+{$ifdef java}
+{$define sdkunit:=jdk15}
+{$else}
+{$define sdkunit:=androidr14}
+{$endif}
+
+uses
+  sdkunit;
+
+var
+  a: system.jlstring;
+begin
+  a:='abc';
+  jlsystem.fout.println(a);
+end.