autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Duplicate local variables when parameter flattening

Open emgerner-msft opened this issue 10 years ago • 0 comments

In some cases when parameter objects are flattened (in the case where they have 2 or less properties), non-compiling code is generated. It looks like an issue where when we flatten parameters we name the parameter object variable the same as a method parameter value.

For example:

public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string availabilitySetName, IDictionary<string, string> tags, ...)

And later we do:

        UpdateParameters tags = null; // Here's where we set it a second time
        if (tags != null)
        {
            tags = new UpdateParameters();
            tags.Tags = tags;
        }

emgerner-msft avatar Feb 24 '16 21:02 emgerner-msft