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

Invalid code generated #15

Closed
dynamix opened this issue Oct 12, 2015 · 4 comments
Closed

Invalid code generated #15

dynamix opened this issue Oct 12, 2015 · 4 comments
Milestone

Comments

@dynamix
Copy link

dynamix commented Oct 12, 2015

If I have something like the following and replace X with int

type _X_ generic.Type

type Cell_X_ struct {
    Value int
}

func m(_X_) {}

func example() {
    a := Cell_X_{}
    m(Cell_X_{})
}

The following code which wont compile is generated.

type CellInt struct {
    Value int
}

func m(int) {}

func example() {
    a := CellInt{}
    m(Cellint{})
}

Is this a limitation in how genny works or a bug?

@matryer
Copy link
Contributor

matryer commented Oct 12, 2015

Looks like a bug in your code. Shouldn't the argument to m be Cell_X_? And shouldn't the value of Value be X?

Sent from my iPhone

On 12 Oct 2015, at 19:15, Martin Karlsch notifications@github.com wrote:

If I have something like the following and replace X with int

type X generic.Type

type Cell_X_ struct {
Value int
}

func m(X) {}

func example() {
a := Cell_X_{}
m(Cell_X_{})
}

The following code which wont compile is generated.

type CellInt struct {
Value int
}

func m(int) {}

func example() {
a := CellInt{}
m(Cellint{})
}
Is this a limitation in how genny works or a bug?


Reply to this email directly or view it on GitHub.

@dynamix
Copy link
Author

dynamix commented Oct 12, 2015

You are right, the example was not entirely correct ... should be.

type _X_ generic.Type

type Cell_X_ struct {
    Value _X_
}

func m(p Cell_X_) {}

func example() {
    a := Cell_X_{}
    m(Cell_X_{})
}

leads to

package main

type CellInt struct {
    Value int
}

func m(p CellInt) {}

func example() {
    a := CellInt{}
    m(Cellint{})
}

The issue is the same. The Cell_X_ passed to m has a lower case "i" whereas the rest has an uppercase "I".

@pdrum
Copy link
Collaborator

pdrum commented Aug 21, 2018

It's almost the same as #49 and #36. Will be fixed in the next release.

@pdrum pdrum added this to the Next release milestone Aug 21, 2018
@pdrum
Copy link
Collaborator

pdrum commented Aug 30, 2018

Fixed in #52

@pdrum pdrum closed this as completed Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants