Included array matching

This commit is contained in:
davu 2023-03-19 17:48:42 +01:00 committed by Jan Jurzitza
parent 95e484a202
commit 8326bdb428
4 changed files with 30 additions and 0 deletions

View File

@ -290,6 +290,13 @@ private bool matchesWithTypeOfPointer(const(DSymbol)* incomingSymbol, const(DSym
}
private bool matchesWithTypeOfArray(const(DSymbol)* incomingSymbol, const(DSymbol)* cursorSymbolType) {
return incomingSymbol.functionParameters.front.type.qualifier == SymbolQualifier.array
&& cursorSymbolType.qualifier == SymbolQualifier.array
&& incomingSymbol.functionParameters.front.type.type is cursorSymbolType.type;
}
/**
* Params:
* incomingSymbol = the function symbol to check if it is valid for UFCS with `beforeDotType`.
@ -313,6 +320,7 @@ bool isCallableWithArg(const(DSymbol)* incomingSymbol, const(DSymbol)* beforeDot
{
return beforeDotType is incomingSymbol.functionParameters.front.type
|| isNonConstrainedTemplate(incomingSymbol)
|| matchesWithTypeOfArray(incomingSymbol, beforeDotType)
|| matchesWithTypeOfPointer(incomingSymbol, beforeDotType)
|| willImplicitBeUpcasted(beforeDotType, incomingSymbol)
|| matchAliasThis(beforeDotType, incomingSymbol, recursionDepth);

View File

@ -0,0 +1,12 @@
identifiers
alignof k
arrayStuff F
doArray F
dup k
idup k
init k
length k
mangleof k
ptr k
sizeof k
stringof k

View File

@ -0,0 +1,5 @@
void arrayStuff(int[] x) { }
void doArray(int[] x, int[] y)
{
y.
}

View File

@ -0,0 +1,5 @@
set -e
set -u
../../bin/dcd-client $1 -c65 file.d > actual_array_test.txt
diff actual_array_test.txt expected_array_test.txt