Ver Fonte

* give an error for high(ansistring) and high(widestring)
(mantis #9579)

git-svn-id: trunk@8370 -

Jonas Maebe há 18 anos atrás
pai
commit
c10b375615
4 ficheiros alterados com 20 adições e 1 exclusões
  1. 2 0
      .gitattributes
  2. 4 1
      compiler/ninl.pas
  3. 7 0
      tests/webtbf/tw9579a.pp
  4. 7 0
      tests/webtbf/tw9579b.pp

+ 2 - 0
.gitattributes

@@ -7439,6 +7439,8 @@ tests/webtbf/tw9522b.pp svneol=native#text/plain
 tests/webtbf/tw9522c.pp svneol=native#text/plain
 tests/webtbf/tw9522d.pp svneol=native#text/plain
 tests/webtbf/tw9522e.pp svneol=native#text/plain
+tests/webtbf/tw9579a.pp svneol=native#text/plain
+tests/webtbf/tw9579b.pp svneol=native#text/plain
 tests/webtbf/uw0744.pp svneol=native#text/plain
 tests/webtbf/uw0840a.pp svneol=native#text/plain
 tests/webtbf/uw0840b.pp svneol=native#text/plain

+ 4 - 1
compiler/ninl.pas

@@ -2109,8 +2109,11 @@ implementation
                                set_varstate(left,vs_read,[]);
                                result:=load_high_value_node(tparavarsym(tloadnode(left).symtableentry))
                             end
+                           else if not is_ansistring(left.resultdef) and
+                                   not is_widestring(left.resultdef) then
+                             result:=cordconstnode.create(tstringdef(left.resultdef).len,u8inttype,true)
                            else
-                             result:=cordconstnode.create(tstringdef(left.resultdef).len,u8inttype,true);
+                             CGMessage(type_e_mismatch)
                          end;
                      end;
                     else

+ 7 - 0
tests/webtbf/tw9579a.pp

@@ -0,0 +1,7 @@
+{ %fail }
+
+var
+ s: ansistring;
+begin
+  writeln(high(ansistring));
+end.

+ 7 - 0
tests/webtbf/tw9579b.pp

@@ -0,0 +1,7 @@
+{ %fail }
+
+var
+ s: widestring;
+begin
+  writeln(high(ansistring));
+end.