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

Wrong result type for function of return type ast.TypeBool #39

Open
fatih opened this issue Dec 5, 2016 · 2 comments
Open

Wrong result type for function of return type ast.TypeBool #39

fatih opened this issue Dec 5, 2016 · 2 comments

Comments

@fatih
Copy link
Contributor

fatih commented Dec 5, 2016

Hi,

The following snippet doesn't return ast.TypeBool anymore:

https://play.golang.org/p/fc9xgAcIvp

Instead it returns:

Type: TypeString
Value: true

It should return TypeBool

@mitchellh mitchellh self-assigned this Dec 6, 2016
@mitchellh
Copy link
Contributor

Hey @fatih, I checked out back to your original PR and then bisected from there and this never evaluated directly to a bool. The logic has always been:

If just a list, evaluate to a list.
If just a map, evaluate to a map.
Otherwise, string.

I'm not sure what the effect would be here of returning other primitives directly (int, bool, etc). So while I don't disagree, I'd want to think that through first... especially for Terraform.

@mitchellh mitchellh removed their assignment Dec 6, 2016
@fatih
Copy link
Contributor Author

fatih commented Dec 12, 2016

Hi @mitchellh

Thanks for the lookup. Weird that I've remember that it was returning ast.TypeBool, but you're right that it indeed returns the ast.TypeString (I've just reread the src code from that PR and it's indeed like that).

I think it would be valuable to make it correct and if we could revisit this as well while we're at fixing a lot of issues as well (such as #42). I leave it up to you. Feel free to close this or let's have this open as a reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants