File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -2839,6 +2839,23 @@ class AnyFunctionType : public TypeBase {
2839
2839
2840
2840
bool hasInternalLabel () const { return !InternalLabel.empty (); }
2841
2841
Identifier getInternalLabel () const { return InternalLabel; }
2842
+
2843
+ // / Return true if argument name is valid and matches \c paramName.
2844
+ // /
2845
+ // / The three tests to check if argument name is valid are:
2846
+ // / 1. allow argument if it matches \c paramName,
2847
+ // / 2. allow argument if $_ for omitted projected value label,
2848
+ // / 3. allow argument if it matches \c paramName without its \c $ prefix.
2849
+ bool matchParameterLabel (Identifier const ¶mName) const {
2850
+ auto argLabel = getLabel ();
2851
+ if (argLabel == paramName)
2852
+ return true ;
2853
+ if ((argLabel.str () == " $_" ) && paramName.empty ())
2854
+ return true ;
2855
+ if (argLabel.hasDollarPrefix () && argLabel.str ().drop_front () == paramName.str ())
2856
+ return true ;
2857
+ return false ;
2858
+ }
2842
2859
2843
2860
ParameterTypeFlags getParameterFlags () const { return Flags; }
2844
2861
Original file line number Diff line number Diff line change @@ -291,13 +291,10 @@ static bool matchCallArgumentsImpl(
291
291
assert (argIdx != numArgs && " Must have a valid index to claim" );
292
292
assert (!claimedArgs[argIdx] && " Argument already claimed" );
293
293
294
- auto argLabel = args[argIdx].getLabel ();
295
294
if (!actualArgNames.empty ()) {
296
295
// We're recording argument names; record this one.
297
296
actualArgNames[argIdx] = expectedName;
298
- } else if (argLabel != expectedName && !ignoreNameClash &&
299
- !(argLabel.str ().startswith (" $" ) &&
300
- argLabel.str ().drop_front () == expectedName.str ())) {
297
+ } else if (!ignoreNameClash && !args[argIdx].matchParameterLabel (expectedName)) {
301
298
// We have an argument name mismatch. Start recording argument names.
302
299
actualArgNames.resize (numArgs);
303
300
You can’t perform that action at this time.
0 commit comments