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

The "out" parameters are not compiled properly. #1930

Closed
LaoR-UA opened this Issue Nov 27, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@LaoR-UA

LaoR-UA commented Nov 27, 2017

What You Are Seeing?

When I create alias that accepts out parameters - cake will generate not working code.
For example, the method:

public interface IVersion
{
 public int Build {get;}
}

public class CusomVersion : IVersion
{
     public CustomVersion(int build)
     {
            Build = build;
     }
     public int Build {get;}
}

[CakeMethodAlias]
public static bool TryParse(this ICakeContext context, string versionToParse, out IVersion version)
{
.....
}

Will generate wrapper:

public System.Boolean TryParse(System.String versionToParse, out MyCake.Common.IVersion& version)
{
    return MyCake.Common.VersionHelper.TryParse(Context, versionToParse, out version);
}

And this leads to a lot of errors due to "&" symbol at the end of out parameter type declaration.

What is Expected?

I expect to see properly generated wrapper and able to use "out" parameters.

What version of Cake are you using?

Cake version is 0.23.0

Are you running on a 32 or 64 bit system?

I am running on 64 bit Windows 10 system (client version, local machine).

@jnm2

This comment has been minimized.

Show comment
Hide comment
@jnm2

jnm2 Nov 27, 2017

Contributor

Now that Cake is on Roslyn, what if you generated syntax nodes in code rather than generating text?

Contributor

jnm2 commented Nov 27, 2017

Now that Cake is on Roslyn, what if you generated syntax nodes in code rather than generating text?

@LaoR-UA

This comment has been minimized.

Show comment
Hide comment
@LaoR-UA

LaoR-UA Nov 27, 2017

I do not generate anything, it was done by Roslyn on compile stage.

LaoR-UA commented Nov 27, 2017

I do not generate anything, it was done by Roslyn on compile stage.

@jnm2

This comment has been minimized.

Show comment
Hide comment
@jnm2

jnm2 Nov 27, 2017

Contributor

@LaoR-UA Sorry I wasn't clear; I was addressing the Cake team.

Contributor

jnm2 commented Nov 27, 2017

@LaoR-UA Sorry I wasn't clear; I was addressing the Cake team.

kcamp added a commit to kcamp/cake that referenced this issue Nov 28, 2017

@devlead devlead self-assigned this Nov 28, 2017

@devlead devlead added the Bug label Nov 28, 2017

@devlead devlead added this to the v0.24.0 milestone Nov 28, 2017

devlead added a commit that referenced this issue Nov 28, 2017

Merge branch 'kcamp-GH-1930' into develop
* kcamp-GH-1930:
  GH-1930: Fix ParameterEmitter to correctly handle reference types as ref/out parameters
@devlead

This comment has been minimized.

Show comment
Hide comment
@devlead

devlead Nov 28, 2017

Member

Fixed by #1934

Member

devlead commented Nov 28, 2017

Fixed by #1934

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment