sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: TypeScript
Issue: Inferring a generic should put the type variable in the inner scope when possible
Labels: Suggestion,Awaiting More Feedback

# Suggestion

## 🔍 Search Terms

* generics
* polymorphism
* type inference

## ✅ 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

When inferring a generic type, put the type variable in the inner scope as long as it's possible to make the result as general as possible.

## 📃 Motivating Example

Say I have a simple composition function:

```typescript
declare const compose: <A, B, C>(f: (a: A) => B, g: (b: B) => C) => (a: A) => C
```

The current version of TS allows me to do this and get the correct type:

```typescript
const comp = compose(<T>(t: T) => t, <T>(t: T) => t); // comp: <T>(a: T) => T
```

But say I want to wrap the result in an object:

```typescript
declare const composeObj: <A, B, C>(f: (a: A) => B, g: (b: B) => C) => { value: (a: A) => C }
```

Now the generic is gone, and `comp` above is typed as `{ value: (a: unknown) => unknown }`. 

I think what's happening is that TS is trying to put the `T` variable outside the scope of the object because if, instead of a wrapping object, I use a wrapping function, this is what happens:

```typescript
declare const composeFun: <A, B, C>(f: (a: A) => B, g: (b: B) => C) => () => (a: A) => C
const comp = composeFun(<T>(t: T) => t, <T>(t: T) => t); // comp: <T>() => (a: T) => T
```

TS is putting `T` on the outer level, so if I call `comp()` the result will be `(a: unknown) => unknown`.  A better result would've been to get `() => <T>(a: T) => T`. This way, calling `comp()` would not discard the type variable and, if I'm not mistaken, the result would be a more general type than the result we currently get, without breaking any typing rules.

## 💻 Use Cases

Being able to wrap generic functions when they're the result of type inference. My specific case was writing a type guarding/converting utility using a wrapper around functions of the form `a -> Maybe<b>` that can be chained together by the dot operator to represent function composition, such that types can be further specified. Something like `Thing.isPrimitive.isNumber.isInteger`. But this is not possible without the possibility to wrap the result of my `compose` function.
Repository: terminal
Issue: Actions Order Rearranged on Save
Labels: Issue-Bug,Product-Terminal,Priority-3,Area-SettingsUI

### Windows Terminal version

1.13.11431.0

### Windows build number

10.0.19044.0

### Other Software

_No response_

### Steps to reproduce

1. Start Windows Terminal.
2. Open WT settings `ctrl` + `,`
3. Navigate to Actions-menu
4. Press Save


### Expected Behavior

Expected the settings to be saved unaltered.

### Actual Behavior

Order in which entries appear is rearranged.


![202206_WindowsTerminal_Bug_Actions](https://user-images.githubusercontent.com/107305966/173250260-f7945d12-3450-4c4f-9acb-7add02d59fd2.gif)
Repository: go
Issue: cmd/go: go work causes go build to error when symlinks are involved
Labels: help wanted,NeedsInvestigation,GoCommand

<!--
Please answer these questions before submitting your issue. Thanks!
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version

go version go1.18 darwin/arm64
</pre>

### Does this issue reproduce with the latest release?

Yes

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/testy/Library/Caches/go-build"
GOENV="/Users/testy/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/testy/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/testy/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.18/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.18/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/testy/tmp/x/lib1/lib2/go.mod"
GOWORK="/Users/testy/tmp/x/go.work"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/qr/4s_dq83s1lddgv10vn9591y80000gn/T/go-build3045518203=/tmp/go-build -gno-record-gcc-switches -fno-common"
</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.
-->
`
mkdir bug
cd bug

mkdir lib1 lib2
cd lib1
go mod init bugsquash.com/lib1
ln -s ../lib2
cd ../lib2
go mod init bugsquash.com/lib2
mkdir -p internal/a
printf "package a\nfunc Foo() {}\n" > internal/a/foo.go
mkdir -p cmd/foo
printf 'package main\nimport "bugsquash.com/lib2/internal/a"\nfunc main() { a.Foo() }\n' > cmd/foo/foo.go
go build cmd/foo/foo.go  # succeeds
cd ../lib1/lib2
go build cmd/foo/foo.go  # succeeds
cd ../../
go work init
go work use ./lib2
cd lib1/lib2
go build cmd/foo/foo.go  
# fails with this message:
# package command-line-arguments
#	cmd/foo/foo.go:2:8: use of internal package bugsquash.com/lib2/internal/a not allowed
cd ../../lib2
go build cmd/foo/foo.go  # succeeds
cd ../
rm go.work
cd lib1/lib2
go build cmd/foo/foo.go  # succeeds
`

### What did you expect to see?

I expect go build to succeed in lib1/lib2 (lib2 is a symlink) even when using go.work. If I remove go.work it works.


### What did you see instead?
`
package command-line-arguments
	cmd/foo/foo.go:2:8: use of internal package bugsquash.com/lib2/internal/a not allowed
`
Repository: TypeScript
Issue: [Feature Request] Add strictNonNullAssertion option to avoid redundant non-null assertions
Labels: Suggestion,Awaiting More Feedback

# Suggestion

## 🔍 Search Terms

List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.

"non null assert", "non null assertion option", "non null assertion redundant", "strict non null assertion" 

## ✅ 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

Similar to how we have the `// @ts-expect-error` override to ignore errors and that only works if there is an error, and then produces an error when it is redundant (ie no errors exist to ignore), it would be useful to have a similar mechanism for non-null assertions ie `!`.

The cleanest way I can think of this is via a tsconfig option such as `strictNonNullAssertion` which would let the compiler check that the non-null assertion is actually used on a nullable or any value property access.

## 📃 Motivating Example

If you have code as follows:
```ts
import someValue from './some-module'

const valueA = someValue.someProperty!.a
```
The above suggests `someValue` has a nullable property `someProperty`, however in the future if this typing changes and the non-null assertion is not required then it becomes noise and then the code would look odd and possibly confusing. If the compiler could flag these redundant usages this would help prevent this and keep code cleaner.
Repository: vscode
Issue: Allow extensions to force-open the references view
Labels: feature-request,references-viewlet

From what I can see it is not possible to force-open the references view. Whether or not that view is opened when calling the command `editor.action.showReferences` seems to depend on the setting `references.preferredLocation`, which is set to `peek` by default. I'd like a way to ignore this setting and force-open the references view, for example through a dedicated command. My use case is implementing a custom command in the Svelte for VS Code extension which in the end should open this view.

It seems you may want this behavior, too, since right now "find file references" is implemented by temporarily switching the user config from "peek" to "view", which creates an empty vscode setting folder/file in the workplace if none exists already, which feels buggy (#134405 would solve this, too, for you, but wouldn't solve my problem)

Searched for: references force view
Repository: pytorch
Issue: caffe2_nvrtc is produced even when it won't be used
Labels: module: build,triaged,module: selective build

### 🐛 Describe the bug

The library is produced whenever CUDA is enabled. However, in the code, lazyNVRTC is called instead of loading this library. The only situation it appears to be used in is for ROCm.

Perhaps the library should only be produced for ROCm builds?

### Versions

Has been like this for a long time. Affects any modern version.

cc @malfet @seemethere @dhruvbird @ljk53
Repository: node
Issue: Node CLI eval option can't take unary negation operator
Labels: confirmed-bug,cli

### Version

v17.9.0

### Platform

Darwin [redacted] 19.6.0 Darwin Kernel Version 19.6.0: Tue Feb 15 21:39:11 PST 2022; root:xnu-6153.141.59~1/RELEASE_X86_64 x86_64

### Subsystem

_No response_

### What steps will reproduce the bug?

Execute the following:

```bash
$ node -pe "-0"
```

And you will get back:

```
node: --eval requires an argument
```

In fact, anything where the `-` comes first, you get this message.

For example, all of the following also result in the above message:

```bash
$ node -pe "-42"
$ node -pe "-"
$ node -pe "-NaN"
```


### How often does it reproduce? Is there a required condition?

It's always reproducable (at least on this version and machine).

### What is the expected behavior?

I'd like it to *not* spit back an error message and give me the evaluated value, please.

### What do you see instead?

An error message detailing that the "eval" option was not given a value.

### Additional information


It seems that the CLI is not properly parsing its arguments?

Prefixing the expression with `0` seems to work:

```bash
$ node -pe "0-42"
42
```

As well as using a comma operator:

```bash
$ node -pe "(0, -42)"
-42
```
Repository: vscode
Issue: Terminal: Copy on selection + new highlight in 1.68 copies previous term on CMD+F
Labels: bug,terminal-find

<!-- ⚠️⚠️ 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/No

<!-- 🪓 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.68.0
(this issue didn't exist on 1.67.2)
- OS Version: macOS Monterey 12.3.1

Steps to Reproduce:

1. In settings.json enable: `"terminal.integrated.copyOnSelection": true,`
2. Open integrated terminal
3. Search for some term that exists in the terminal (that will be highlighted/selected)
4. Focus on editor and type + copy some chunk of text
5. Focus on terminal, press CMD+F and paste what you just copied

Expected:

The pasted term is the term you just copied

Actual:

The pasted term is the term you last searched for (in step 3).


Why this happens?

Because:
1. When you press CMD+F in terminal, the terminal has pre-existing term typed in the search box (from your first search)
2. Terminal uses this term to highlight all occurrences of such term in the terminal
3. Highlighting the terms makes the terminal also copy this term to clipboard due to `"terminal.integrated.copyOnSelection": true,`
Repository: pytorch
Issue: SymInt equality tests are unsound
Labels: triaged

### 🐛 Describe the bug

Current implementation is  

```
  bool operator==(const SymInt& p2) const {
    return data_ == p2.data_;
  }

  bool operator!=(const SymInt& p2) const {
    return data_ != p2.data_;
  }

```

This is unsound. Two sym ints can be referencing different symbolic variables but after guarding on their concrete values we may discover they are equal and == should return true. These need to be virtualized like the rest of the operators on SymInt.

@Krovatkin 

### Versions

master
Repository: HelloGitHub
Issue: 【开源自荐】Rust实现高性能UDP可靠传输协议
Labels: Rust 项目

## 推荐项目

- 项目地址：https://github.com/b23r0/rust-raknet/

- 类别：Rust

- 项目标题：Rust实现高性能UDP可靠传输协议

- 项目描述：Raknet是一个成熟的UDP可靠传输协议，知名游戏Minecraft采用该协议作为游戏客户端和服务器通信协议。本项目通过逆向工程和参考老版facebook的c++实现，使用Rust重新实现该协议，同时用异步IO替代老版c++协议的多线程模型，还解决了老版本c++实现存在的大量线程和内存泄漏问题。项目目前在生产环境中同时支撑数千玩家在线游戏，在小包高频的网络游戏场景下，遇到丢包率较高的情况，相比TCP能降低50%的平均网络延迟。项目同时兼容了Minecraft最新版本，可用于Minecraft中间件开发的底层协议库使用。

- 亮点：

* 异步
* 快速重传&选择重传&无延迟ACK
* 跨平台支持（Linux&Windows&OSX&FreeBSD）
* 兼容Minecraft

- 示例代码：

```rs
//server

async fn serve(){
    let mut listener = RaknetListener::bind("127.0.0.1:19132".parse().unwrap()).await.unwrap();
    listener.listen().await;
    loop{
        let mut socket = listener.accept().await.unwrap();
        let buf = socket.recv().await.unwrap();
        if buf[0] == 0xfe{
            //do something
        }
    }
}

```

```rs
//client

async fn connect(){
    let socket = RaknetSocket::connect("127.0.0.1:19132".parse().unwrap()).await.unwrap();
    socket.send(&[0xfe], Reliability::ReliableOrdered).await.unwrap();
    let buf = socket.recv().await.unwrap();
    if buf[0] == 0xfe{
        //do something
    }
}
```

- 后续更新计划：

* 持续优化性能
* 为Python/Nodejs等提供绑定库
* 支持更多参数选项
* 支持纯ARQ调用
* 流量控制
Repository: TypeScript
Issue: Return type is `any` of getter in object passed as generic 
Labels: Bug,Help Wanted

# Bug Report

When the following is true:
* You are passing an object created inline to a function
* The type of that function argument is generic
* The object has a getter that accesses `this`
* The object also has a function

Then the return type of the getter will be `any`.

If you either remove the function from the object or create the object before passing it into the function the getter will return the correct type.

### 🔎 Search Terms
any, object, generic

### 🕗 Version & Regression Information
- Bug present in all versions available on the playground, including nightly

### ⏯ Playground Link
[Playground link with relevant code](https://www.typescriptlang.org/play?ts=4.7.2&ssl=16&ssc=1&pln=15&pc=4#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXwHMRUQYswAeAFQD4AKANwC54qBKFqgbgCgeB6fvAAKUAM5isqAvBwAjAFbgM8YFjiYIAT3gYchYqR0EsDEGN1aADggAGUVFtuz8toioAWWOm1s8weGIqQThw8AC8BiRkYHQA3jzw8B4gEBA4LABEXpkANHxJgvBwGMgw+BjWCDiIBhgYpPBYFg5aiXXJ3mzwCYVCAHoA-O1JJWUVXmIAdClpOLxJAL757UUAkrVaOMjFIAC2OGa6k0homLioubul5ZY2srXuDTDwAO5YafByCEFk0u3AHAAZRwexAGC80h8PXgix4izYvH8gRUcAskRCcBmWAEQiS8CGfD4RVEEikMnkSkwqnUym0un0RGixlM5judlazjw8Dc4M6Pj8AVQQVkigiPXas3SWRyKz613G7IedWeTQsv3J7Xc-O6vXgRUJ+IVtwhzRmqXSC1hctUwNB4MhBGhcVh8N4QpFmJAACZxUzSOQ6JS2HwPajzL6MXo4N7sbijYSgA)

### 💻 Code

<!-- Please post the relevant code sample here as well-->
```ts
declare function generic<T>(v: T): T;

// Passing object directly to genery gives type `any` on `get hi()`
const store = generic({
  hello: "hi",

  // return type of getter is any
  get hi() {
    return this.hello;
  },

  // If you remove this function, return type of getter will be string
  doSomething() { }
});

const res = store.hi // any

// Passing object directly to genery gives type `any` on `get hi()`
const obj = {
  hello: "hi",

  // return type of getter is string
  get hi() {
    return this.hello;
  },

  doSomething() { }
};
const store2 = generic(obj)

const res2 = store2.hi // string

```

### 🙁 Actual behavior

Return type of getters are `any`

### 🙂 Expected behavior

Return type of getters have the type of the returned data
Repository: deno
Issue: Add watch mode for deno check
Labels: good first issue,feat,help wanted,--watch

For me it would make a lot of sense to run `check` in watch mode. 
I think that adding check subcommand was a great idea, and running it in watch mode would provide the best development experience (at least for me). Also  if I'm not mistaken it would check further edits faster, as typescript compiler is already warmed up after the first check.

```
deno check --watch
```
Repository: pytorch
Issue: Conda enviroment
Labels: triaged

### 🐛 Describe the bug

Traceback (most recent call last):
  File "/data1/yvr/.conda/envs/opt/bin/opt-baselines", line 33, in <module>
    sys.exit(load_entry_point('metaseq==0.0.1', 'console_scripts', 'opt-baselines')())
  File "/data1/yvr/.conda/envs/opt/lib/python3.7/site-packages/metaseq-0.0.1-py3.7-linux-x86_64.egg/metaseq/launcher/opt_baselines.py", line 314, in cli_main
    get_grid, postprocess_hyperparams, add_extra_options_func=add_extra_options_func
  File "/data1/yvr/.conda/envs/opt/lib/python3.7/site-packages/metaseq-0.0.1-py3.7-linux-x86_64.egg/metaseq/launcher/sweep.py", line 378, in main
    backend_main(get_grid, postprocess_hyperparams, args)
  File "/data1/yvr/.conda/envs/opt/lib/python3.7/site-packages/metaseq-0.0.1-py3.7-linux-x86_64.egg/metaseq/launcher/slurm.py", line 34, in main
    grid = get_grid(args)
  File "/data1/yvr/.conda/envs/opt/lib/python3.7/site-packages/metaseq-0.0.1-py3.7-linux-x86_64.egg/metaseq/launcher/opt_baselines.py", line 78, in get_grid
    raise RuntimeError("Where are you running this?! Check DATA_LOCATIONS.")
RuntimeError: Where are you running this?! Check DATA_LOCATIONS.

### Versions

After I conda environment following the setup.md,I plan to follow the train.md,it comes to the bug?
Repository: angular
Issue: Missing `standalone` components declared with `button[custom-button]` are not reported by the compiler
Labels: area: core,area: compiler,core: directive matching,P3,compiler: template type-checking,cross-cutting: standalone

### Which @angular/* package(s) are the source of the bug?

core

### Is this a regression?

No

### Description

When standalone component is created with `@Component({ selector: 'button[cv-button]'` it will be not reported during compile time

### Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-standalone-uzrsmn?file=src%2Fmain.ts

### Please provide the exception or error you saw

```true
No message is displayed in Console about missing info, uncomment 59 line to make component work
```


### Please provide the environment you discovered this bug in (run `ng version`)

```true
Angular CLI: 14.0.0
Node: 14.18.2
Package Manager: yarn 3.2.0
OS: win32 x64

Angular: 14.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.0
@angular-devkit/build-angular   14.0.0
@angular-devkit/core            14.0.0
@angular-devkit/schematics      14.0.0
@schematics/angular             14.0.0
rxjs                            7.5.5
typescript                      4.7.3
```


### Anything else?

_No response_
Repository: kubernetes
Issue: Extended resource cannot be over-committed
Labels: sig/api-machinery,triage/accepted

Since this PR [#48922](https://github.com/kubernetes/kubernetes/pull/48922), extended resource outside *kubernetes.io namespace cannot be over-committed.

From the implementation of kubernetes, this is just a validation in apiserver, this constraint itself has no other effect (or a side effect without it).

Take a general look at the current rules:

- all resources are expressed within kubernetes using resource.Quantity, which means you can use the expression "2000m".
- resources without '/' or contain 'kubernetes.io' are treated with native resource，and native resource can be over-commited.
- all resources except native ones can not be over-commited, there is a validation in apiserver to ensure it.
- all resources except cpu are integers, apiserver will check for decimals and scheduler will use  quantity.Value() to compute resource.

In some scenarios, custom extension resources need the semantics of limit > request, for example, the IOPS and BPS resources of the network and disk IO. Under the above restrictions, similar requirements need to be achieved by this:

1. add a component(device-plugin or  similar component) for reporting extended resources to node
2. user fills in the request value(net-bps request) in the extended resource, add add a annotation to express the net-bps limit
3. related components need to be customized to perceive this annotation, ext., if the scheduling scoring plugin needs to rely on limit, the scheduler needs to be aware of this annotation
 
This complicates the expansion of upper-level users and makes the logic confusing. I propose to cancel the restriction that extended resources can not be over-commited. At the implementation level, we can start from a namespace with a certain prefix and gradually drive the ecology to perceive this change.