<commit_before><!--{
	"Title": "Go 1.18 Release Notes",
	"Path":  "/doc/go1.18"
}-->

<!--
NOTE: In this document and others in this directory, the convention is to
set fixed-width phrases with non-fixed-width spaces, as in
<code>hello</code> <code>world</code>.
Do not send CLs removing the interior tags from such phrases.
-->

<style>
  main ul li { margin: 0.5em 0; }
</style>

<h2 id="introduction">DRAFT RELEASE NOTES — Introduction to Go 1.18</h2>

<p>
  <strong>
    Go 1.18 is not yet released. These are work-in-progress
    release notes. Go 1.18 is expected to be released in February 2022.
  </strong>
</p>

<h2 id="language">Changes to the language</h2>

<p>
  TODO: complete this section
</p>

<h3 id="bug_fixes">Bug fixes</h3>

<p>
  The Go 1.18 compiler now correctly reports <code>declared but not used</code> errors
  for variables that are set inside a function literal but are never used. Before Go 1.18,
  the compiler did not report an error in such cases. This fixes long-outstanding compiler
  issue <a href="https://golang.org/issue/8560">#8560</a>. As a result of this change,
  (possibly incorrect) programs may not compile anymore. The necessary fix is
  straightforward: fix the program if it was in fact incorrect, or use the offending
  variable, for instance by assigning it to the blank identifier <code>_</code>.
  Since <code>go vet</code> always pointed out this error, the number of affected
  programs is likely very small.
</p>

<h3 id="generics">Generics</h3>

<p>
Go 1.18 includes an implementation of generics as described
by <a href="https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md">the
proposal</a>.
</p>

<p>
  The current generics implementation has the following limitations:
  <ul>
    <li><!-- issue 47631 -->
      The Go compiler cannot currently handle type declarations inside generic functions
      or methods. We hope to provide support for this feature in Go 1.19.
    </li>
  </ul>
</p>

<h2 id="ports">Ports</h2>

<h3 id="freebsd">FreeBSD</h3><commit_msg>doc/go1.18: document new overflow error for some untyped arguments to print/ln<commit_after><!--{
	"Title": "Go 1.18 Release Notes",
	"Path":  "/doc/go1.18"
}-->

<!--
NOTE: In this document and others in this directory, the convention is to
set fixed-width phrases with non-fixed-width spaces, as in
<code>hello</code> <code>world</code>.
Do not send CLs removing the interior tags from such phrases.
-->

<style>
  main ul li { margin: 0.5em 0; }
</style>

<h2 id="introduction">DRAFT RELEASE NOTES — Introduction to Go 1.18</h2>

<p>
  <strong>
    Go 1.18 is not yet released. These are work-in-progress
    release notes. Go 1.18 is expected to be released in February 2022.
  </strong>
</p>

<h2 id="language">Changes to the language</h2>

<p>
  TODO: complete this section
</p>

<h3 id="bug_fixes">Bug fixes</h3>

<p>
  The Go 1.18 compiler now correctly reports <code>declared but not used</code> errors
  for variables that are set inside a function literal but are never used. Before Go 1.18,
  the compiler did not report an error in such cases. This fixes long-outstanding compiler
  issue <a href="https://golang.org/issue/8560">#8560</a>. As a result of this change,
  (possibly incorrect) programs may not compile anymore. The necessary fix is
  straightforward: fix the program if it was in fact incorrect, or use the offending
  variable, for instance by assigning it to the blank identifier <code>_</code>.
  Since <code>go vet</code> always pointed out this error, the number of affected
  programs is likely very small.
</p>

<p>
  The Go 1.18 compiler now reports an overflow when passing a rune constant expression
  such as <code>'1' << 32</code> as an argument to the predeclared functions
  <code>print</code> and <code>println</code>, consistent with the behavior of
  user-defined functions. Before Go 1.18, the compiler did not report an error
  in such cases but silently accepted such constant arguments if they fit into an
  <code>int64</code>. As a result of this change, (possibly incorrect) programs
  may not compile anymore. The necessary fix is straightforward: fix the program if it
  was in fact incorrect, or explicitly convert the offending argument to the correct type.
  Since <code>go vet</code> always pointed out this error, the number of affected
  programs is likely very small.
</p>

<h3 id="generics">Generics</h3>

<p>
Go 1.18 includes an implementation of generics as described
by <a href="https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md">the
proposal</a>.
</p>

<p>
  The current generics implementation has the following limitations:
  <ul>
    <li><!-- issue 47631 -->
      The Go compiler cannot currently handle type declarations inside generic functions
      or methods. We hope to provide support for this feature in Go 1.19.
    </li>
  </ul>
</p>

<h2 id="ports">Ports</h2>

<h3 id="freebsd">FreeBSD</h3>
{'fraction_non_alphanumeric': 0.10918614020950847, 'fraction_numerical': 0.028605962933118453, 'mean_word_length': 3.8297665369649807, 'pattern_counts': {'":': 4, '<': 111, '<?xml version=': 0, '>': 109, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1404635', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1510, 'n_words': 657}