Skip to content

Conversation

@dkegel-fastly
Copy link
Contributor

@dkegel-fastly dkegel-fastly commented Mar 18, 2022

Seems to get 1.18 tests closer to passing.

I don't know llvm, so this was a bit of a guess.

For #2515 / #2718

@deadprogram deadprogram requested a review from aykevl March 18, 2022 17:33
Copy link
Member

@aykevl aykevl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a better way to fix this:

- switch argTypes[0].(type) {
+ switch argTypes[0].Underlying().(type) {

This strips off the named type and makes the type switch work directly with the underlying type (which should be a *types.Chan or *types.Slice).

Copy link
Member

@aykevl aykevl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. A test would be good but I couldn't get one to work, the following already works for me:

package main

type Buffer []byte

func main() {
	l := make(Buffer, 3, 5)
	println(len(l), cap(l))
}

func foo(l Buffer) {
	println(len(l), cap(l))
}

But it's small and matches the len builtin, so merging.

@aykevl aykevl merged commit aa421bf into tinygo-org:dev Mar 19, 2022
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

Successfully merging this pull request may close these issues.

2 participants