Browse Source

* patch by Bart Broersma to allow to declare "LongInt = AnsiString" comparison
operator in non-macpas modes, resolves #29460

git-svn-id: trunk@43709 -

florian 5 years ago
parent
commit
2f374a37b7
3 changed files with 20 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 1 0
      compiler/htypechk.pas
  3. 18 0
      tests/webtbs/tw29460.pp

+ 1 - 0
.gitattributes

@@ -17515,6 +17515,7 @@ tests/webtbs/tw2943.pp svneol=native#text/plain
 tests/webtbs/tw2944.pp svneol=native#text/plain
 tests/webtbs/tw29444.pp svneol=native#text/pascal
 tests/webtbs/tw2946.pp svneol=native#text/plain
+tests/webtbs/tw29460.pp svneol=native#text/pascal
 tests/webtbs/tw29471.pp svneol=native#text/plain
 tests/webtbs/tw2949.pp svneol=native#text/plain
 tests/webtbs/tw29491.pp svneol=native#text/plain

+ 1 - 0
compiler/htypechk.pas

@@ -333,6 +333,7 @@ implementation
                              (treetyp in order_theoretic_operators)
                            ) or
                            (
+                             (m_mac in current_settings.modeswitches) and
                              is_stringlike(rd) and
                              (ld.typ=orddef) and
                              (treetyp in string_comparison_operators)) or

+ 18 - 0
tests/webtbs/tw29460.pp

@@ -0,0 +1,18 @@
+program project1;
+
+{$mode objfpc}{$H+}
+{$modeswitch advancedrecords}
+
+operator = (z1: LongInt; z2 : ansistring) b : boolean;
+begin
+  b := false;
+end;
+
+var
+  i: longint;
+  s: string;
+begin
+  if i = s then
+    halt(1);
+  writeln('ok');
+end.