mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-08 20:24:27 +02:00
fcl-passrc: resolver: error on setlength(openarray)
git-svn-id: trunk@37466 -
This commit is contained in:
parent
3a0e540dde
commit
69f2055ff3
@ -886,7 +886,7 @@ type
|
||||
|
||||
TPasResolverOption = (
|
||||
proFixCaseOfOverrides, // fix Name of overriding proc/property to the overriden proc/property
|
||||
proClassPropertyNonStatic, // class property accessor must be non static
|
||||
proClassPropertyNonStatic, // class property accessors are non static
|
||||
proPropertyAsVarParam, // allows to pass a property as a var/out argument
|
||||
proClassOfIs, // class-of supports is and as operator
|
||||
proExtClassInstanceNoTypeMembers, // class members of external class cannot be accessed by instance
|
||||
@ -8251,7 +8251,7 @@ begin
|
||||
Result:=cExact
|
||||
else if ParamResolved.BaseType=btContext then
|
||||
begin
|
||||
if IsDynArray(ParamResolved.TypeEl) then
|
||||
if IsDynArray(ParamResolved.TypeEl) and not IsOpenArray(ParamResolved.TypeEl) then
|
||||
begin
|
||||
Result:=cExact;
|
||||
DynArr:=NoNil(ParamResolved.TypeEl) as TPasArrayType;
|
||||
|
@ -565,6 +565,7 @@ type
|
||||
Procedure TestArray_OpenArrayOfString;
|
||||
Procedure TestArray_OpenArrayOfString_IntFail;
|
||||
Procedure TestArray_OpenArrayOverride;
|
||||
Procedure TestArray_OpenArrayAsDynArraySetLengthFail;
|
||||
Procedure TestArray_CopyConcat;
|
||||
Procedure TestStaticArray_CopyConcat;// ToDo
|
||||
Procedure TestArray_CopyMismatchFail;
|
||||
@ -9250,6 +9251,20 @@ begin
|
||||
ParseProgram;
|
||||
end;
|
||||
|
||||
procedure TTestResolver.TestArray_OpenArrayAsDynArraySetLengthFail;
|
||||
begin
|
||||
ResolverEngine.Options:=ResolverEngine.Options+[proOpenAsDynArrays];
|
||||
StartProgram(false);
|
||||
Add([
|
||||
'procedure DoIt(a: array of byte);',
|
||||
'begin',
|
||||
' SetLength(a,3);',
|
||||
'end;',
|
||||
'begin']);
|
||||
CheckResolverException('Incompatible type arg no. 1: Got "array of Byte", expected "string or dynamic array variable"',
|
||||
nIncompatibleTypeArgNo);
|
||||
end;
|
||||
|
||||
procedure TTestResolver.TestArray_CopyConcat;
|
||||
begin
|
||||
StartProgram(false);
|
||||
|
Loading…
Reference in New Issue
Block a user