소스 검색

* prefer object->object over object->intf

git-svn-id: trunk@1491 -
peter 20 년 전
부모
커밋
09a0dff4da
3개의 변경된 파일32개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 0
      .gitattributes
  2. 3 2
      compiler/defcmp.pas
  3. 28 0
      tests/webtbs/tw3829.pp

+ 1 - 0
.gitattributes

@@ -6249,6 +6249,7 @@ tests/webtbs/tw3805.pp svneol=native#text/plain
 tests/webtbs/tw3812.pp svneol=native#text/plain
 tests/webtbs/tw3814.pp svneol=native#text/plain
 tests/webtbs/tw3827.pp svneol=native#text/plain
+tests/webtbs/tw3829.pp -text svneol=unset#text/plain
 tests/webtbs/tw3833.pp svneol=native#text/plain
 tests/webtbs/tw3840.pp svneol=native#text/plain
 tests/webtbs/tw3863.pp svneol=native#text/plain

+ 3 - 2
compiler/defcmp.pas

@@ -1095,7 +1095,8 @@ implementation
                              if hd3.implementedinterfaces.searchintf(def_to)<>-1 then
                                begin
                                   doconv:=tc_class_2_intf;
-                                  eq:=te_convert_l1;
+                                  { don't prefer this over objectdef->objectdef }
+                                  eq:=te_convert_l2;
                                   break;
                                end;
                              hd3:=hd3.childof;
@@ -1113,7 +1114,7 @@ implementation
                    else if (def_from.deftype=variantdef) and is_interface(def_to) then
                      begin
                        doconv:=tc_variant_2_interface;
-                       eq:=te_convert_l1;
+                       eq:=te_convert_l2;
                      end
                    { ugly, but delphi allows it }
                    else if (eq=te_incompatible) and

+ 28 - 0
tests/webtbs/tw3829.pp

@@ -0,0 +1,28 @@
+{ Source provided for Free Pascal Bug Report 3829 }
+{ Submitted by "Thomas Schatzl" on  2005-03-25 }
+{ e-mail:  }
+{$mode delphi}
+
+uses
+  sysutils;
+
+type
+  IAny = interface  ['{A40AEE53-8C88-4DD2-9F14-05A8C1A64849}']
+  end;
+
+  TAny = class(TInterfacedObject, IAny)
+  end;
+
+var
+  a : TAny;
+
+begin
+  a:=TAny.Create;
+
+  (a as IAny)._Addref();
+
+  if (supports(a, IAny)) then
+    writeln('ok')
+  else
+    halt(1);
+end.