1. 19 Feb, 2019 8 commits
  2. 17 Feb, 2019 2 commits
  3. 16 Feb, 2019 1 commit
  4. 15 Feb, 2019 6 commits
  5. 13 Feb, 2019 5 commits
  6. 12 Feb, 2019 8 commits
  7. 11 Feb, 2019 10 commits
    • Robert Griesemer's avatar
      go/types: permit signed integer shift count · 6fa13365
      Robert Griesemer authored
      Permit shifts by non-constant signed integer shift counts.
      Share logic for constant shift counts in non-constant
      shifts and improve error messages a little bit.
      
      R=Go1.13
      
      Updates #19113.
      
      Change-Id: Ia01d83ca8aa60a6a3f4c49f026e0c46396f852be
      Reviewed-on: https://go-review.googlesource.com/c/159317
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      6fa13365
    • Robert Griesemer's avatar
      text/scanner: accept new Go2 number literals · 710417bc
      Robert Griesemer authored
      This CL introduces text/scanner support for the new binary and octal integer
      literals, hexadecimal floats, and digit separators for all number literals.
      The new code is closely mirroring the respective code for number literals in
      cmd/compile/internal/syntax/scanner.go.
      
      Uniformly use the term "invalid" rather than "illegal" in error messages
      to match the respective error messages in the other scanners directly.
      
      R=Go1.13
      
      Updates #12711.
      Updates #19308.
      Updates #28493.
      Updates #29008.
      
      Change-Id: I2f291de13ba5afc0e530cd8326e6bf4c3858ebac
      Reviewed-on: https://go-review.googlesource.com/c/161199
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      710417bc
    • Robert Griesemer's avatar
      cmd/compile: do not export float or complex constants with -asmhdr · 33ac8544
      Robert Griesemer authored
      The -asmhdr flag is used to generate header files for assembly code
      such that that code has access to compile-time constants. During
      the build these constants end up in the (ephemeral) file go_asm.h.
      
      For historical reasons, floating-point and complex constants are
      printed with a 'p' exponent but with decimal mantissa; also, because
      of the compiler-internal precision of 512 bits, the mantissae are quite
      large (and conversions are comparatively slow).
      
      With the changes to the new Go 2 number literals, the respective
      upcoming changes to text/scanner (which in turn is used by the assembler)
      will make text/scanner newly accept hexadecimal floats; but also decimal
      floats using the incorrect 'p' exponent and report an error in that case.
      
      As a consequence, the assembler will report an error when trying to parse
      the before-mentioned decimal floating-point values which are using 'p'
      exponents. Since these constants are never needed in the assembly code,
      do not emit them in the first place.
      
      Change-Id: I06c7c96b04e8d062441120107992472f87a651b2
      Reviewed-on: https://go-review.googlesource.com/c/161904
      Run-TryBot: Robert Griesemer <gri@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      33ac8544
    • Robert Griesemer's avatar
      text/scanner: don't crash when calling TokenText in error handler · 85c1798a
      Robert Griesemer authored
      Make sure Scanner.tokEnd is set before we call Scanner.Error
      and update documentation accordingly.
      (Until now tokEnd was only set before returning from Scan,
      so a call to TokenText during error handling may have crashed.)
      
      While at it, tighten a check in Scanner.TokenText to ensure
      Scanner.tokEnd >= Scanner.tokPos if we have a token.
      
      Also, silence error messages to Stderr in unrelated TestIllegalExponent.
      
      Fixes #29723.
      
      Change-Id: Ia97beeae91eaf9e0ed3dada0a806f1f7122461cc
      Reviewed-on: https://go-review.googlesource.com/c/157819Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
      85c1798a
    • Robert Griesemer's avatar
      cmd/gofmt: normalize number prefixes and exponents · 69de40c9
      Robert Griesemer authored
      Rewrite non-decimal number prefixes to always use a lower-case base
      ("0X" -> "0x", etc.), and rewrite exponents to use a lower-case 'e'
      or 'p'. Leave hexadecimal digits and 0-octals alone.
      
      Comparing the best time of 3 runs of `time go test -run All` with
      the time for a gofmt that doesn't do the rewrite shows no increase
      in runtime for this bulk gofmt application (in fact on my machine
      I see a small decline, probably due to cache effects).
      
      R=Go1.13
      
      Updates #12711.
      Updates #19308.
      Updates #29008.
      
      Change-Id: I9c6ebed2ffa0a6a001c59412a73382090955f5a9
      Reviewed-on: https://go-review.googlesource.com/c/160184Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      69de40c9
    • Robert Griesemer's avatar
      go/types: add tests for new Go 2 number literals · 257f3043
      Robert Griesemer authored
      This CL ensures that go/types can now handle the new
      Go 2 number literals. The relevant changes enabling
      them in go/types were made in go/constant in the CL
      https://golang.org/cl/160239.
      
      R=Go1.13
      
      Updates #12711.
      Updates #19308.
      Updates #28493.
      Updates #29008.
      
      Change-Id: I45c1387198fac94769ac59c5301d86b4e1a1ff98
      Reviewed-on: https://go-review.googlesource.com/c/160240Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      257f3043
    • Robert Griesemer's avatar
      go/constant: accept new Go2 number literals · 1f701200
      Robert Griesemer authored
      This CL introduces go/constant support for the new binary and octal integer
      literals, hexadecimal floats, and digit separators for all number literals.
      
      R=Go1.13
      
      Updates #12711.
      Updates #19308.
      Updates #28493.
      Updates #29008.
      
      Change-Id: I7a55f91b8b6373ae6d98ba923b626d33c5552946
      Reviewed-on: https://go-review.googlesource.com/c/160239Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      1f701200
    • Robert Griesemer's avatar
      cmd/gofmt: test that Go 2 number literals can be formatted · 149d9de4
      Robert Griesemer authored
      R=Go1.13
      
      Updates #12711.
      Updates #19308.
      Updates #28493.
      Updates #29008.
      
      Change-Id: Icd25aa7f6e18ed671ea6cf2b1b292899daf4b1a5
      Reviewed-on: https://go-review.googlesource.com/c/160018Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      149d9de4
    • Robert Griesemer's avatar
      go/scanner: accept new Go2 number literals · 42e0cc60
      Robert Griesemer authored
      This CL introduces go/scanner support for the new binary and octal integer
      literals, hexadecimal floats, and digit separators for all number literals.
      The new code is closely mirroring the respective code for number literals in
      cmd/compile/internal/syntax/scanner.go.
      
      R=Go1.13
      
      Updates #12711.
      Updates #19308.
      Updates #28493.
      Updates #29008.
      
      Change-Id: I5315c6aaa7cfc41a618296be20e3acd5114d6b3c
      Reviewed-on: https://go-review.googlesource.com/c/159997Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      42e0cc60
    • Robert Griesemer's avatar
      cmd/compile: accept new Go2 number literals · ceb849dd
      Robert Griesemer authored
      This CL introduces compiler support for the new binary and octal integer
      literals, hexadecimal floats, and digit separators for all number literals.
      
      The new Go 2 number literal scanner accepts the following liberal format:
      
      number   = [ prefix ] digits [ "." digits ] [ exponent ] [ "i" ] .
      prefix   = "0" [ "b" |"B" | "o" | "O" | "x" | "X" ] .
      digits   = { digit | "_" } .
      exponent = ( "e" | "E" | "p" | "P" ) [ "+" | "-" ] digits .
      
      If the number starts with "0x" or "0X", digit is any hexadecimal digit;
      otherwise, digit is any decimal digit. If the accepted number is not valid,
      errors are reported accordingly.
      
      See the new test cases in scanner_test.go for a selection of valid and
      invalid numbers and the respective error messages.
      
      R=Go1.13
      
      Updates #12711.
      Updates #19308.
      Updates #28493.
      Updates #29008.
      
      Change-Id: Ic8febc7bd4dc5186b16a8c8897691e81125cf0ca
      Reviewed-on: https://go-review.googlesource.com/c/157677Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: default avatarRuss Cox <rsc@golang.org>
      ceb849dd