sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: go
Issue: io: add an `Err` field to `LimitedReader`
Labels: Proposal,Proposal-Accepted,NeedsFix

New Proposal
=========

As per @ianlancetaylor's suggestion, this proposal is now to add an `Err` field to `io.LimitedReader`. If not `nil`, this field's value will be returned when trying to read past the limit imposed by the reader instead of the default `io.EOF`.

Original Proposal
===========

For various reasons, I had a need to use `MaxBytesReader()` in a situation where a `ResponseWriter` wasn't easily available, so I looked through the code to see if it was safe to pass `nil` and found that all it does is check a type assertion and then call an unexported method on it:

```go
type requestTooLarger interface {
	requestTooLarge()
}
if res, ok := l.w.(requestTooLarger); ok {
	res.requestTooLarge()
}
```

While it's true that because of this it's safe to pass it a `nil` `ResponseWriter`, it feels quite odd to rely on undocumentated behavior of this kind.

### Proposal

Several ways to clean this situation up come to mind:

1) Add an alternative in the `http` package that doesn't need a `ResponseWriter`. Because of how it works, it could actually just return the same implementation, but the function will be more obvious in its usage.
2) Document how the implementation uses the `ResponseWriter` and explicitly state that a `nil` `ResponseWriter` is valid.
3) Add a reimplementation of `MaxBytesReader()` in `io` that doesn't use a `ResponseWriter` at all and isn't tied to `http` behavior, but includes the other differences. This could actually be done, for the most part, by just adding an `Err error` field to `io.LimitedReader` that, if non-nil, is the error returned when the limit is reached instead of `io.EOF`.

In whichever case, the documentation for `MaxBytesReader()` should probably be filled in a bit. It is quite odd that something called `Reader` requires a type that is primarily an `io.Writer` implementation for non-obvious reasons and doesn't mention it anywhere in the documentation.
Repository: TypeScript
Issue: [lib] readonly modifier is missing in a lot of places
Labels: Suggestion,In Discussion

# lib Update Request

I have code that does not type-check because of missing readonly modifiers.

For instance the following code does not type-check:

```ts
declare const vals: readonly number[]
Math.max.apply(null, vals)
                     ^^^^
                     Argument of type 'readonly number[]' is not
                     assignable to parameter of type 'number[]'
```
[Playground link](https://www.typescriptlang.org/play?#code/CYUwxgNghgTiAEYD2A7AzgF3gNyhNAXPHFMKhAJ7woCuAtgEYgwDaAugLABQAslBgAsAdHSgAPIVAAOUygApaECABoceNAEogA)

This is caused by the following signatures:

```ts
interface Math {
    max(...values: number[]): number
}

interface CallableFunction extends Function {
    apply<T, A extends any[], R>(this: (this: T, ...args: A) => R, thisArg: T, args: A): R
}
```
These signatures should be replaced by:

```ts
interface Math {
    max(...values: readonly number[]): number
}

interface CallableFunction extends Function {
    apply<T, A extends readonly any[], R>(this: (this: T, ...args: A) => R, thisArg: T, args: A): R
}
```
[Playground link](https://www.typescriptlang.org/play?#code/CYUwxgNghgTiAEYD2A7AzgF3gNyhNAXPHFMKhAJ7woCuAtgEYgwDaAugLABQAslBgAsAdHSgAPIVAAOUygApaECABoceNAEpu3AJYoMzAGZQwCPoPgBvbvFvxRYuUOe4INEIWIhS5KrUbM7BpE-kww3AC+2lx6BjDGpvAAwnjQDBAgAGI0KGAYOqjwIGIGKMBo8Nm5+YXWXHbw0rIUADwAKqoAgkUlIGUVJGQolI0oFOyqAEoAfHKCOp5zAgtEHfDOkjAA5p6dGvAAvNPwk6rzaJ3bq6qwO0R7RJOR3EA)

Basically every array rest parameter should be readonly, and there is other places in the library where readonly should be added. I already made these changes on a [fork](https://github.com/Conaclos/TypeScript-1/commits/main) (see the last commit of the fork). I'm not sure how to proceed. there is a lot of changes to perform. Maybe the changes should be spitted in several ones?

Note that a lot of changes could be avoided if TypeScript implicitly handled array rest paramter as readonly (regardless the presence or the absence of the readonly modifier). I do not see any value to have mutable array rest parameter. However, this adds a special case in the type-checker, and I am personally not a big fan of that.
Repository: go
Issue: x/tools/cmd/goimports: line directive can cause file corruption
Labels: NeedsInvestigation,Tools

<!--
Please answer these questions before submitting your issue. Thanks!
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.17.6 linux/amd64
</pre>

goimports version v0.1.9..

### Does this issue reproduce with the latest release?

Yes, also on playground.

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN="/home/user/bin"
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/user/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/user/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.6"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/user/thinking/linedirective/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build229616347=/tmp/go-build -gno-record-gcc-switches"
</pre></details>

### What did you do?

<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on go.dev/play is best.
-->

Run goimports on the following program.
```
package main

import (
	"fmt"
	"os"
)

//line :4

// Comment
func main() {
	fmt.Fprintln(os.Stderr, "Hello world!")
}
```

### What did you expect to see?

No change.

### What did you see instead?

```
package main

import (
	"fmt"
	"os" //line :4
	// Comment
)

func main() {
	fmt.Fprintln(os.Stderr, "Hello world!")
}
```

This can be reproduced [here](https://go.dev/play/p/gEpx_dz-FYH) by clicking the format button.
Repository: angular
Issue: Extended diagnostics should link to angular.dev documentation
Labels: feature,area: compiler,feature: under consideration

### Which @angular/* package(s) are relevant/releated to the feature request?

compiler-cli

### Description

Extended diagnostics have fairly comprehensive documentation on https://angular.io/extended-diagnostics/, with a page for each error code. These include explanations of exactly why the pattern is bad, what users can do about it, and how to suppress it if necessary. Currently however, users get only an error message in their console / IDE. This is hopefully expressive enough for many users, but it is not as comprehensive as AIO, and we should be pointing users to that documentation if they have any questions.

### Proposed solution

Extended diagnostics should include a link to their AIO page. Ideally, this is something they can do automatically in a common format so future diagnostics implicitly get this link and incentivize the team to continue to write comprehensive documentation about these checks.

### Alternatives considered

N/A
Repository: go
Issue: cmd/go: document .lock files in the module cache
Labels: Documentation,help wanted,NeedsInvestigation,GoCommand,modules

.lock files in the go modules cache are a frequent source of issues for us. Take the following common use case for example: when running go in a Docker container that has had dependencies installed into it as part of building the Docker image, these dependencies are naturally owned by `root` with 755 permissions.

However, when running `go build` in the container, naturally, the user is no longer root at this time, and one sees frequent issues in the form of:
```
../cmd/app/main.go:6:2: open /go/pkg/mod/cache/download/github.com/<user>/<repo>/@v/v1.9.0.lock: permission denied
```
because the root-owned file is obviously not writable to the user.

I was very surprised to see there was no documentation of this type of file available anywhere. I would like to suggest that, for example [this page](https://go.dev/ref/mod) would explain the purpose and functioning of these files, to  provide insight into errors such as these, so they can be resolved. Alternatively, I would also welcome a suggested workflow change, to make these files no longer a problem, such that they can stay implementation details that can be disregarded by the user.
Repository: godot
Issue: Vulkan: Problem with antialiasing on draw_polyline and Line2D
Labels: bug,topic:rendering,regression,topic:2d

### Godot version

4.0 alpha 1 (but probably also earlier versions)

### System information

Windows 11

### Issue description

Hello. There is problem with antialiasing in Line2D (here just not working) and also with aliasing when using _draw():

When you set aliased to true in draw_polyline. Line will be smoth on sides but not at the end.

![image](https://user-images.githubusercontent.com/62170071/153298490-1ca6d640-83b3-4650-8e32-4f19989bbc6b.png)


### Steps to reproduce

Look above.

### Minimal reproduction project

_No response_
Repository: vscode
Issue: SCM input box always has focus border if validation message is present
Labels: bug,scm

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.65.0-insider
- OS Version: Windows 11

Steps to Reproduce:

1. Change commitDirectlyWarning setting to 'always'
2. Change inputValidationLength setting to 1
3. Enter >1 character
4. Click away from input box e.g. the explorer
5. 🐛input box still has focus border. This results in a state where multiple elements appear to have focus
![image](https://user-images.githubusercontent.com/30305945/153300212-380b5273-c1fe-43e4-a0b0-7d21f3396523.png)

This is very noticeable in vscode.dev/github and github.dev because RemoteHub displays a validation message by default to notify the user that their commits go straight to the remote. However the problem repros for any SCM provider which does input validation.
Repository: deno
Issue: Console.log CSS should support initial (or unset/revert)
Labels: web,suggestion,ext/console

When pretty-printing output, it's common to apply a style for a span, before reverting back to the terminal's default style. This is used in terminal prompts and in log output, for example.

<img width="474" alt="Screenshot of ANSI-colored terminal prompt" src="https://user-images.githubusercontent.com/30874884/153315512-41463270-3b5f-4c77-9eba-314c2dfbcba3.png">

As a specific motivating example, consider this output (this program does not output color to non-tty stdouts).
```sh
; deno run --allow-env --allow-net --allow-hrtime src/index.ts | cat
Check file:///[snipped]/src/index.ts
Listening on port 8000
status=200 route="POST /" duration=1.3ms
status=200 route="GET /" duration=0.3ms
status=200 route="PUT /" duration=0.2ms
status=200 route="DELETE /" duration=0.2ms
status=200 route="HEAD /" duration=0.1ms
```

With color, it looks like this:

<img width="422" alt="image" src="https://user-images.githubusercontent.com/30874884/153316681-a34e9438-88df-4b14-a8dc-9e7e7eaa00a9.png">

But what if we want to use background-color instead?

<img width="439" alt="image" src="https://user-images.githubusercontent.com/30874884/153316625-3292cb7e-2bad-40c5-91b5-bc1f19ae2887.png">

In this case, I simply forgot to change the `color: white` used as resets to `background-color: black`. That's an easy fix, but it shows the limitations of the current level of support. Furthermore, this color reset is *fragile*. What if the user uses a green terminal background?

<img width="306" alt="image" src="https://user-images.githubusercontent.com/30874884/153317278-f7a9accb-88fd-4965-9279-11752ee5015b.png">

This breaks in an ugly way.

A quick test reveals that support exists in Firefox:

```js
console.log('%cRED%cUNSET', 'color: red', 'color: unset')
```
<img width="389" alt="image" src="https://user-images.githubusercontent.com/30874884/153317805-a9cd8dbd-3f5d-40be-9be1-b0a06ce25860.png">

Thus, implementing at least one of `initial`/`unset`/`revert` is needed to make it easier to write good programs with well-formatted console output, in addition to improving parity with web platforms.
Repository: pytorch
Issue: upstream `apex.normalization.FusedRMSNorm`
Labels: feature,module: nn,triaged,module: norms and normalization

### 🚀 The feature, motivation and pitch

All T5 models and their derivatives (t5, mt5, t0, etc.) use `RMSNorm`, instead of `LayerNorm`. The former is a subset of the latter, it only scales and doesn't shift.

The original need was a discovery that all HF Transformers t5-based models were somewhat slow under mixed precision, because of "manual" implementation of `T5LayerNorm` where manual up/down- casting was causing a significant bottleneck.

While researching this I have run into other users who wanted to use a fast `RMSNorm` (but didn't save the references)

NVIDIA/apex [recently implemented `apex.normalization.FusedRMSNorm`](https://github.com/NVIDIA/apex/pulls?q=is%3Apr+FusedRMSNorm+is%3Aclosed) but building apex is far from easy for a lay person. 

I have benchmarked it in an ensemble and it gives a pretty significant gain - about 10% improvement on the full back-to-back application. https://github.com/huggingface/transformers/pull/14656 - so clearly multiple times faster on just the norm part.

So to ease user's path to faster t5-based models if possible it'd be great to have this sub-set functionality of `LayerNorm` available in pytorch.

It's already in the nvfused branch: https://github.com/csarofeen/pytorch/pull/1428

I will see if I can find other users who may want a fast `RMSNorm`

Thank you!




cc @albanD @mruberry @jbschlosser @walterddr @kshitij12345
Repository: storybook
Issue: CLI: Add `sb serve` to serve static storybook
Labels: feature request,cli

- [ ] `main.js` config for output dir
- [ ] serve using `http-server` or the like
- [ ] update docs
Repository: flutter
Issue: The recognizer property of TextSpan does not handle events correctly when element is updated
Labels: framework,f: gestures,has reproducible steps,P2,found in release: 2.10,found in release: 2.11,team-framework,triaged-framework

## Steps to Reproduce

1. Execute `flutter run` on the code sample or copy the code to [dartpad](https://dartpad.dev/) and run.
2. Click `Increment RichText` twice.
3. Click `Increment Button` twice.
4. Click `Increment RichText` twice.
5. View logs.

**Expected results:**
<details>
  <summary>Logs</summary>

```
Click TextSpan：0
Click TextSpan：1
Click Button：2
Click Button：3
Click TextSpan：4
Click TextSpan：5
```

</details>

**Actual results:** 
<details>
  <summary>Logs</summary>

```
Click TextSpan：0
Click TextSpan：0
Click Button：2
Click Button：3
Click TextSpan：0
Click TextSpan：0
```

</details>

<details>
<summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';

void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: const Text('Provider example'),
          ),
          body: Center(
            child: CounterWidget(),
          )),
    ),
  );
}

class CounterWidget extends StatefulWidget {
  @override
  State createState() {
    return CounterState();
  }
}

class CounterState extends State<CounterWidget> {
  int count = 0;

  @override
  Widget build(BuildContext context) {
    int c = count;
    return Column(
      children: [
        Text("$c", style: const TextStyle(fontSize: 32)), // show right value
        RichText(
          // key: UniqueKey(), // set key can print right value
          text: TextSpan(
            text: "Increment RichText",
            style: const TextStyle(color: Colors.green, fontSize: 32),
            recognizer: TapGestureRecognizer()
              ..onTap = () {
                count++;
                setState(() {});
                print("Click TextSpan: $c"); // always 0
              },
          ),
        ),
        const Padding(padding: EdgeInsets.only(top: 20)),
        InkWell(
          child: const Text("Increment Button", style: TextStyle(fontSize: 32)),
          onTap: () {
            count++;
            setState(() {});
            print("Click Button: $c"); // print right value
          },
        )
      ],
    );
  }
}
```

</details>
Repository: TypeScript
Issue: Smarter type alias preservation for unions originating from type query types
Labels: Suggestion,Domain: Quick Info,Experience Enhancement

# Suggestion

## 🔍 Search Terms

smarter type alias preservation, type query types

## ✅ Viability Checklist

My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).

## ⭐ Suggestion

TypeScript 4.2 introduced intelligent type alias preservation for most union types. This greatly improved visibility when dealing with large union types. This preservation should be extended to union types created by via type query types.

Could probably also be considered a bug / missing edge case.

## 📃 Motivating Example

[Playground link](https://www.typescriptlang.org/play?ts=4.5.4#code/KYDwDg9gTgLgBAYwgOwM7wMoHkCyBRAfQGEsA5DAFTgF44BvAKDjgDcBDAGwFdhkuBbAIwAuOIIA0TVpx59+AJlHzJzdt14CAzKM0rp6uQBZRhvWtkCArKMtmZG-gDZRjyQF8GDUJFhwYATzBgOAwIfmAiFHQKQODaAKCIADMQ3EIScgpPAHpsuABaQqLCz29oeATggGlgf1QaOABrWuSQsIiomBighlzmfoG4AD0AflLwcr9YtvDItC7Y+QbGVXs5ETE7AwFFOGUpcwdtOF0DtYFjOFMz7f5rOFsbiycXd3GfCumauqXaZv9WqFZp1usB5L08oMBqMgA)

```ts twoslash
export const SOME_CONST = {
  valuenum1: 1,
  valuenum2: 2,
  valuenum3: 3,
}

export type SomeConstType = typeof SOME_CONST

export type Keys = keyof SomeConstType
//          ^? type Keys = "valuenum1" | "valuenum2" | "valuenum3" | "valuenum4" | "valuenum5" | "valuenum6" - ☹️ 

// --------

export type SomeConstType2 = {
  valuenum1: number,
  valuenum2: number,
  valuenum3: number,
}

export type Keys2 = keyof SomeConstType2
//          ^? type Keys2 = keyof SomeConstType2 - 😄 
```

Ref: https://github.com/TypeStrong/typedoc/issues/1867
Repository: flutter
Issue: [ListTile] Support custom height constraints of leading/trailing
Labels: c: new feature,framework,f: material design,c: proposal,P3,team-design,triaged-design

https://github.com/flutter/flutter/blob/0ce527eb91a37ef31b60ed6d4a9613310f2107d4/packages/flutter/lib/src/material/list_tile.dart#L1620-L1633

The leading and trailing widget is limited to height 48/56, if we want to show a larger image as leading widget, it's impossible because of these constraints.
I'm not sure how Material Design takes this, but flutter as a framework should allow developers to custom this property, let material design spec be the default, not the only choice.

This is an extreme example, the image size is set to 132x144, but sadly height is limited.
![image](https://user-images.githubusercontent.com/56487872/153359368-976f0aa8-d3ed-4b0b-8157-7ca36ae6c2d4.png)
Repository: ant-design
Issue: Some last characters got trimmed for some custom (Other than system) font families.
Labels: Inactive

- [x] I have searched the [issues](https://github.com/ant-design/ant-design/issues) of this repository and believe that this is not a duplicate.

### Reproduction link
[![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/basic-usage-antd-4-18-6-forked-81xxp?file=/index.js)

### Steps to reproduce
- It's already reproduced. The link is attached.
- Here we added 75000 characters.

### What is expected?
- All characters should be shown with any type of font family.

### What is actually happening?
- Some last characters got trimmed for some custom (Other than system) font families. 

| Environment | Info |
|---|---|
| antd | 4.18.6 |
| React | 16.14.0 |
| System | Mac OS 12.2 |
| Browser | Google Chrome Version 98.0.4758.80 (Official Build) (x86_64) |


<!-- generated by ant-design-issue-helper. DO NOT REMOVE -->
Repository: pytorch
Issue: Some inplace ops don't raise on incompatible shapes and meta device
Labels: module: tests,triaged,module: meta tensors

The repro is basically a stripped down version of

https://github.com/pytorch/pytorch/blob/d891b730c535e2bf201c43badadc282e315d66e9/test/test_torch.py#L796

```py
import torch

fns_3_args = {"map2"}
fns_value_kwarg = {}

for fn in ["copy", "map", "map2", "masked_fill", "masked_scatter"]:
    small = torch.empty([1], device="meta")
    large = torch.empty([2, 1, 2, 1], device="meta")
    full1d = large.clone().flatten()
    print(fn, small.shape, large.shape, end=" ")

    def tensorfn_inplace(t0, t1, t2=None):
        t0_fn = getattr(t0, fn + "_")
        if fn == "lerp":
            return t0_fn(t1, 0.5)
        elif fn == "masked_scatter":
            return t0_fn(t1 < 0.5, full1d)
        elif fn == "masked_fill":
            return t0_fn(t1 < 0.5, 1.0)
        elif fn == "map":
            return t0_fn(t1, lambda x, y: x + y)
        elif fn == "map2":
            return t0_fn(t1, t2, lambda x, y, z: x + y + z)
        elif fn in fns_3_args:
            return t0_fn(1.0, t1, t2)
        elif fn in fns_value_kwarg:
            return t0_fn(t1, t2, value=1.0)
        else:
            return t0_fn(t1)


    tensorfn_inplace(small, large, large)
```

Since the number of elements are not the same, the snippet above should fail, but runs just fine.

This test currently passes since meta tensors raise an error in `self.assertEqual` which is ignored by the test suite and thus the code above is never hit. #72508 adds support for meta tensors in `self.assertEqual` and thus will skip test for meta tensors unconditionally.

cc @mruberry