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

cmd/compile: duplicate error for string -> []byte{} conversion #8438

Closed
adonovan opened this issue Jul 28, 2014 · 4 comments
Closed

cmd/compile: duplicate error for string -> []byte{} conversion #8438

adonovan opened this issue Jul 28, 2014 · 4 comments
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@adonovan
Copy link
Member

In http://play.golang.org/p/RoelsmSVrI, this statement yields two errors:

  _ = []byte{"foo"}
  // cannot convert "foo" to type byte
  // cannot use "foo" (type string) as type byte in array element

One seems like plenty.  

FWIW, a similar pair of errors is emitted for other types T in []T{"foo"}.
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-none, suggested.

@frederich
Copy link
Contributor

Comment 2:

It yields two errors only for string and raw string literals where T can be of any type.
two errors:
  []T{""}
  []T{``} 
one error:
  []T{string("")}
  []T{string(``)}
  []T{true}
  []T{complex128(1)}
  []T{true}
  []T{string(0x266c)}
  []T{float32(0.49999999)}
  []T{0.49999)}

@frederich
Copy link
Contributor

Comment 3:

I'll fix the issue.

@adonovan adonovan added new Suggested Issues that may be good for new contributors looking for work to do. labels Oct 7, 2014
@bradfitz bradfitz removed the new label Dec 18, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/gc: duplicate error for string -> []byte{} conversion cmd/compile: duplicate error for string -> []byte{} conversion Jun 8, 2015
@gopherbot
Copy link

CL https://golang.org/cl/40531 mentions this issue.

@golang golang locked and limited conversation to collaborators Apr 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

6 participants