Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructor with Base edge cases #298

Closed
belav opened this issue Jun 12, 2021 · 2 comments · Fixed by #373
Closed

Constructor with Base edge cases #298

belav opened this issue Jun 12, 2021 · 2 comments · Fixed by #373
Milestone

Comments

@belav
Copy link
Owner

belav commented Jun 12, 2021

These are a couple of edge cases for the constructors with bases

        public ChangePassword(
            HttpClient client,
            IHtmlDocument changePassword,
            DefaultUIContext context
        ) : base(client, changePassword, context) {
            _changePasswordForm = HtmlAssert.HasForm("#change-password-form", changePassword);
        }
// should probably be
        public ChangePassword(
            HttpClient client,
            IHtmlDocument changePassword,
            DefaultUIContext context
        ) : base(client, changePassword, context)
        {
            _changePasswordForm = HtmlAssert.HasForm("#change-password-form", changePassword);
        }
// but I think no body should be
        public ChangePassword(
            HttpClient client,
            IHtmlDocument changePassword,
            DefaultUIContext context
        ) : base(client, changePassword, context) { }

I'm not sure why this one is different than the existing test case

    protected ColorSpan(RgbColor rgbColor, AnsiControlCode ansiControlCode)
        : base(
        GetName(rgbColor) ?? throw new ArgumentNullException(nameof(rgbColor)),
        ansiControlCode
    )
    {
        RgbColor = rgbColor;
    }
// Should probably be this
    protected ColorSpan(RgbColor rgbColor, AnsiControlCode ansiControlCode)
        : base(
            GetName(rgbColor) ?? throw new ArgumentNullException(nameof(rgbColor)),
            ansiControlCode
        )
    {
        RgbColor = rgbColor;
    }

This is the existing test case when it has a body

    public ReallyLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooogMethodName()
        : base(
            reallyLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongParameterIMeanIt
        )
    {
        var x = 1;
    }
@belav belav added type:bug Something isn't working area:formatting labels Jun 12, 2021
@belav
Copy link
Owner Author

belav commented Jun 12, 2021

I think this is covered above, but just in case here is another weird edge case

        public IncludedMember(TypeMap typeMap, LambdaExpression memberExpression)
            : this(
            typeMap,
            memberExpression,
            Variable(
                memberExpression.Body.Type,
                string.Join("", memberExpression.GetMembersChain().Select(m => m.Name))
            ),
            memberExpression
        ) { }
// should be
        public IncludedMember(TypeMap typeMap, LambdaExpression memberExpression)
            : this(
                typeMap,
                memberExpression,
                Variable(
                    memberExpression.Body.Type,
                    string.Join("", memberExpression.GetMembersChain().Select(m => m.Name))
                ),
                memberExpression
            ) { }

@belav
Copy link
Owner Author

belav commented Jun 14, 2021

This is also related

public record LotsOfParametersWithBaseWithLots(
    string longNameParameter,
    string areTheyCalledParametersWithRecords,
    string theyLookLikeParameters
)
    : BaseRecord(
          longNameParameter,
          areTheyCalledParametersWithRecords,
          theyLookLikeParameters,
          "someExtraValueToMakeThisReallyLong"
      );
// should be
public record LotsOfParametersWithBaseWithLots(
    string longNameParameter,
    string areTheyCalledParametersWithRecords,
    string theyLookLikeParameters
) : BaseRecord(
          longNameParameter,
          areTheyCalledParametersWithRecords,
          theyLookLikeParameters,
          "someExtraValueToMakeThisReallyLong"
      );

belav added a commit that referenced this issue Jul 26, 2021
@belav belav added this to the 0.9.8 milestone Jul 26, 2021
belav added a commit that referenced this issue Jul 26, 2021
belav added a commit that referenced this issue Jul 27, 2021
* Fixing some edge cases for ConstructorDeclaration

closes #298

* Handling an edge case found while reviewing code

* Another edge case

* Undoing some changes that weren't actually needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant