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

[Bug]: Any implementation is incorrect #2

Open
benjivesterby opened this issue Jan 25, 2022 · 0 comments
Open

[Bug]: Any implementation is incorrect #2

benjivesterby opened this issue Jan 25, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@benjivesterby
Copy link
Member

This doesn't compile. It should work.

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"strings"
)

func main() {

	readers := As[io.Reader](
		strings.NewReader(""),
		bufio.NewReader(strings.NewReader("")),
		bytes.NewBuffer([]byte("")),
	)

	fmt.Printf("%T\n", readers)

	buffers1 := []*bytes.Buffer{
		bytes.NewBuffer([]byte("")),
		bytes.NewBuffer([]byte("")),
		bytes.NewBuffer([]byte("")),
		bytes.NewBuffer([]byte("")),
		bytes.NewBuffer([]byte("")),
	}

	// breaders := As[io.Reader](buffers1...)

	stringrs := []*strings.Reader{
		strings.NewReader(""),
	}

	strs := As[io.Reader](stringrs...)

	var all []io.Reader
	// all = append(all, buffers1...)

	all = Merge[io.Reader](breaders...)
}

func As[T any](in ...T) []T {
	return in
}
@benjivesterby benjivesterby added the bug Something isn't working label Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant