sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: TypeScript
Issue: JS type-checking suggested refactoring produces maximum possible redundant relative module path
Labels: Bug,Domain: Quick Fixes

I'm trying to use JavaScript type-checking (which obviously is powered by TypeScript) in my project, and am noticing that it seems unable to correctly produce minimal relative paths when executing the "Infer parameter types from usage" refactoring.

<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:**  3.2.2 and 3.3.0-dev.20181228

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**
javascript checkjs module path infer relative

**Code**

jsconfig.json (in root of folder):

```json
{
  "compilerOptions": {
    "checkJs": true,
    "target": "esnext",
    "module": "commonjs",
  },
  "include": [
    "src/**/*.js"
  ]
}
```

```js
// src/foo.js
export class Foo {}

// src/bar.js
export function run (foo) { }

// src/main.js
import { run } from './bar';
import { Foo } from './foo';

function main () {
  run(new Foo());
}
```

**Expected behavior:**

In bar.js, the type information suggested refactorings includes "Infer parameter types from usage". Upon performing this refactoring, the `foo` parameter should become associated with a minimal path to the target module, like so:

```js
/**
 * @param {import("./foo").Foo} foo
 */
export function run (foo) { }
```

**Actual behavior:**

Instead, it generates this:

```js
/**
 * @param {import("../../../../../../Dropbox/Work/Dev/salix/current/src/foo").Foo} foo
 */
export function run (foo) { }
```

I have tested this in both the stable and insider builds of VS Code. I have tried various different combinations of settings in jsconfig.json, including `include`, `exclude`, `compilerOptions.baseUrl`, `compilerOptions.module`, and so on. The issue persists with every permutation of options I've tried.

![2018-12-29_07-11-28](https://user-images.githubusercontent.com/298883/50528271-0bc4d080-0b39-11e9-8459-017080822b43.gif)

**Related Issues:** <!-- Did you find other bugs that looked similar? -->
No relevant issues found in either of the TypeScript or VSCode repositories.
Repository: vscode
Issue: workbench.editor.closeEmptyGroups not showing up when searching "pane"
Labels: bug,settings-editor,confirmed,settings-search

i usually set up 2 equal width,,horizontally split-ed panes and 1 full width under them .

currently i found no way to create editor-width pane at bottom, if you have at least 2 column ones (like was possible in VS) .
~~add to this a fact of that the full width panel auto closes with it's last tab, and it becomes an issue (so if the last tab at bottom are accidentally closed, its needed to close 1 of the upper panes, split to bottom and then split to side again) .~~ (Close Empty Groups setting, it misses "Pane" as a {search tag}/synonym)

this may look minor, but the splitting functionality just basically not complete, ~~and ability to control tabs auto-closing behavior are missed~~.
Repository: terminal
Issue: Console ReadFile canceled by Ctrl+C fails to set ERROR_OPERATION_ABORTED
Labels: Product-Conhost,Area-Server,Issue-Bug,Impact-Compatibility

In Windows 8+, a [`ReadFile`](https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-readfile) call on a console input handle that's interrupted by Ctrl+C or Ctrl+Break doesn't set the last error to `ERROR_OPERATION_ABORTED` (995). It used to do this in previous versions, and it's documented as such. (It still works for `ReadConsole` in all versions.) The consequence is that there's no immediate way to distinguish Ctrl+C from EOF (i.e. success with 0 bytes read) when reading from the console via `ReadFile`. 

When a read is interrupted by Ctrl+C, the console returns (and has always returned, AFAIK) the NT status code `STATUS_ALERTED` (0x00000101), which is a success code for an alerted wait (e.g. via `NtAlertThread`). This status code is being misused outside of its intended context, but previously its usage was completely private to the console client/server implementation. What changed is that in Windows 8+ the console uses the ConDrv device instead of an LPC port, and console files are now kernel file objects. `ReadFile` and `ReadConsole` used to have a common implementation that special cased `STATUS_ALERTED`.  But now they're split up. `ReadFile` calls `NtReadFile` and `ReadConsole` calls `NtDeviceIoControlFile` (due to the `pInputControl` parameter). `ReadConsole` can still special case `STATUS_ALERTED`. On the other hand, to `ReadFile` it's simply a successful read, since there's no immediate way to detect a console handle without making another system call. 

Maybe `ReadFile` can safely assume that no other device would be so weird as to return `STATUS_ALERTED` for a read request. Alternatively, ConDrv or the I/O manager could bring back the practice of flagging console handles by setting the lower 2 bits, as was done prior to Windows 8. Then `ReadFile` could easily detect a console handle and special case `STATUS_ALERTED`.

The proper status code is `STATUS_CANCELLED` (0xC0000120), which automatically maps to `ERROR_OPERATION_ABORTED`. It's a failure code, however, and according to the docs this case is supposed to succeed with an error set. I don't understand this. The call really has been canceled and really has failed. It's no different from an I/O request getting canceled by `CancelIo` or `CancelSynchronousIo`.
Repository: terminal
Issue: GenerateConsoleCtrlEvent should not succeed when dwProcessGroupId is not a group ID
Labels: Product-Conhost,Help Wanted,Area-Server,Issue-Bug,Priority-2,Impact-Correctness

The `dwProcessGroupId` parameter of `GenerateConsoleCtrlEvent` should be limited to process groups or the special group 0 that means all process attached to the console. If no process belongs to the given group ID, the call should fail with `ERROR_INVALID_PARAMETER`. This used to be the case (and the code I've read in ReactOS seems as simple as this), but at some point (XP?) it was changed to succeed for any process ID if it happens to be a child of a process that's attached to the console. I have to assume this was intentional, though I don't think any explanation could get me to agree with the intent.

If the target process is attached to the console, it behaves the same as the group 0 case, which contributes to misunderstandings about this function. Otherwise it's relatively benign. The truly weird and buggy aspect of this is that it succeeds for a child of a process that's attached to the console even if the child itself is not attached to the console (e.g. a non-console process, or one created with `DETACHED_PROCESS`, `CREATE_NEW_CONSOLE`, or `CREATE_NO_WINDOW`). In this case the call appears to do nothing. But on closer inspection, we see that the target process gets added to the console's process list (i.e. `GetConsoleProcessList`) even though it's not attached to the console, and in Process Explorer we see that conhost.exe has a handle for the process. If the process terminates, the console doesn't get notified, so this handle for a defunct process stays in the console's list. Apparently this puts the console's process list in a bad state. All processes that were added before the defunct process are subsequently invisible to `GenerateConsoleCtrlEvent`, even if we target group 0.
Repository: pytorch
Issue: documentation for adding a new type via C++ extensions
Labels: module: docs,triaged,module: complex,module: bfloat16

## 📚 Documentation

@soumyarooproy writes:

-----------------------------------------------------

I wrote this tutorial — https://github.com/soumyarooproy/scratchpad/blob/master/PyTorchNewTensorType.md — for steps to add a new scalar/tensor type. I used `bfloat16` as an example. Could one of you please take a look at it? The write-up is obviously based on my current understanding of PyTorch internals. I would very much appreciate some feedback on it.

Accompanying references:
- pytorch changes: https://github.com/soumyarooproy/pytorch/pull/1
- c++ extension repo:
https://github.com/soumyarooproy/bfloat16_pytorch_cpp_extn

----------------------------------------------------

Because it's the holidays, I'm just opening an issue to track and give feedback so that it doesn't get lost in the noise.

cc: @li-roy @gchanan @goldsborough @ezyang 

@soumyarooprooy things will likely change fast, see PRs by @li-roy for context such as https://github.com/pytorch/pytorch/pull/15153

cc @ezyang @anjali411 @dylanbespalko @mruberry @Lezcano @nikitaved @brianjo
Repository: pytorch
Issue: [Caffe2] How to switch to test phase?
Labels: caffe2

Hi, I just spent 1 hour looking at the documentation and some tutorials on the website, and googling ; but I cannot figure out how I can put a net in testing phase. I would like an equivalent in Caffe2 of `net.set_phase_test()`.
Repository: TypeScript
Issue: TS2739: Type  is missing the following properties from type
Labels: Bug,Domain: Contextual Types

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section!

Please help us by doing the following steps before logging an issue:
  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues
  * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ

Please fill in the *entire* template below.
-->

<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:**  3.3.0-dev.201xxxxx

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**

**Code**

```ts
export const sp = '_@_';

export interface IWordsOutput
{
	_source?: any,

	s?: RegExp,
	r?: string | IRegExpCallback,

	flags?: string,
}

export interface IRegExpCallback
{
	($0: string, $1?: string, $2?: string, $3?: string, ...argv): string;
}

export interface IWords extends IWordsOutput
{
	[0]: string | RegExp,
	[1]: string | IRegExpCallback,
	[2]?: string,
}

export const words_source: IWords[] = [

	// this is work
	['HP', 'HP'],

	// Error:TS2739: Type 'string[]' is missing the following properties from type 'IWords': [0], [1]
	(function ()
	{
		let jobclass = '(?:A|B|C)';

		return [`${jobclass}${sp}${jobclass}`, '$1・$2'];
	})(),

];
```

**Expected behavior:**

> no error

**Actual behavior:**

> Error:TS2739: Type 'string[]' is missing the following properties from type 'IWords': [0], [1]

**Playground Link:** <!-- A link to a TypeScript Playground "Share" link which demonstrates this behavior -->

**Related Issues:** <!-- Did you find other bugs that looked similar? -->
Repository: pytorch
Issue: Feature request: transposed locally connected layer
Labels: todo,module: nn,triaged,enhancement

## 🚀 Feature

transposed version of locally connected layer, similar to the transposed version of convolution layer but without weight sharing.

## Motivation

Similar to the necessity of the transposed convolution layer,  the locally connected layer (issue #499, PR #1583) should also have a transposed version.



cc @albanD @mruberry @jbschlosser
Repository: go
Issue: math: Pow(x,y) optimization for cases: constant integer `y`. 
Labels: NeedsDecision

math.Pow(x,y) optimization for cases: constant integer `y`. For example:
* `... math.Pow(length, 2)...`
* `... math.Pow(length, 3.0)...`

### What version of Go are you using (`go version`)?

<pre>
$ go version
go version go1.11.4 linux/amd64
</pre>

### Does this issue reproduce with the latest release?
yes for `go 1.6`

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/konstantin/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/konstantin/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build700464290=/tmp/go-build -gno-record-gcc-switches"

</pre></details>

### What did you do?

```go
package main

import (
        "math"
        "testing"
)

func BenchmarkMathPow(b *testing.B) {
        x := 42.0
        for i := 0; i < b.N; i++ {
                _ = math.Pow(x, 2.0)
        }
}

func BenchmarkInline(b *testing.B) {
        x := 42.0
        for i := 0; i < b.N; i++ {
                _ = x * x
        }
}
```

### What did you expect to see?
same or preliminary same performance between that 2 cases.

### What did you see instead?
run benchmark
```
> go test -bench=.
goos: linux
goarch: amd64
pkg: tmp
BenchmarkMathPow-4   	30000000	        49.6 ns/op
BenchmarkInline-4    	2000000000	         0.68 ns/op
PASS
ok  	tmp	2.992s
```
Different more 70 times.

### Note

Changing function `pow` in [math/pow.go](https://github.com/golang/go/blob/master/src/math/pow.go) is not enough for solving performance problem.
```go

func BenchmarkPowModify(b *testing.B) {
	x := 42.0
	for i := 0; i < b.N; i++ {
		_ = pow(x, 2.0)
	}
}

func pow(x, y float64) float64 {
	switch {
	case y == 0 || x == 1:
		return 1

// changes for cases with integer `y`.
	case float64(int8(y)) == y:
		if y < 0 {
			return 1.0 / pow(x, -y)
		}
		n := int(y)
		r := 1.0
		for i := 0; i < n; i++ {
			r *= x
		}
		return r

	case math.IsNaN(x) || math.IsNaN(y):
		return math.NaN()

... other like in file math/pow.go ....
```
result is better, but not `the best`:
```
BenchmarkMathPow-4     	30000000	        49.6 ns/op
BenchmarkPowModify-4   	200000000	         7.56 ns/op
BenchmarkInline-4      	2000000000	         0.69 ns/op
PASS
ok  	tmp	5.268s
```

Have we any optimization place for change AST from function expressions `math.Pow` with parameter `y` = 2 to expression `x*x`? (Like I understood `ssa` is not a right place).
Repository: opencv
Issue: Error to build OpenCV 4.0.1 in Debug mode from source 
Labels: priority: low,category: build/install

##### System information (version)

- OpenCV => 4.0.1
- Operating System / Platform => Windows 10 64 Bit
- Compiler => MinGW 7.3.0 x64 (from last Qt 5.12)
- CMake => 3.13.2
-Build Type => Source (4.0.1 from https://github.com/opencv/opencv/releases)
##### Detailed description

Can not to build OpenCV 4.0.1 in Debug mode.
An error is raised during compilation:
` Fatal error: can't close CMakeFiles\opencv_perf_core.dir\perf\opencl\perf_arithm.cpp.obj: File too big`
Which probably can be solved with flags for gcc: `-Wa,-mbig-obj`.
![123](https://user-images.githubusercontent.com/21986402/50541813-a4516400-0bbe-11e9-88ee-945a52a798e7.JPG)


##### Steps to reproduce

1) Install Qt 5.12 with Tools: MinGW 7.3.0
2) Install CMake 3.13.2
3) Run CMake and set path to opencv source code and path to build binaries and press Configure button.
4) In CMAKE group set CMAKE_BUILD_TYPE to Debug.
5) Press Generate button.
6) Open CMD and change dir to opencv "build binaries" folder from step 3 and execute `mingw32-make.exe -j8` (Example: `D:\Qt\Tools\mingw730_64\bin\mingw32-make.exe -j8`).

##### Error

```
 [ 28%] Built target pch_Generate_opencv_highgui
 [ 28%] Built target opencv_highgui
 [ 28%] Built target opencv_ts_pch_dephelp
 [ 28%] Built target pch_Generate_opencv_ts
 [ 29%] Built target opencv_ts
 [ 29%] Building CXX object modules/core/CMakeFiles/opencv_perf_core.dir/perf/opencl/perf_arithm.cpp.obj
 D:/Qt/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/as.exe: CMakeFiles\opencv_perf_core.dir\perf\opencl\perf_arithm.cpp.obj: too many sections (37620)
 C:\Users\User\AppData\Local\Temp\ccWlqdOA.s: Assembler messages:
 C:\Users\User\AppData\Local\Temp\ccWlqdOA.s: Fatal error: can't fill 1 byte in section .rdata$_ZStL19piecewise_construct of CMakeFiles\opencv_perf_core.dir\perf\opencl\perf_arithm.cpp.obj: 'File too big'
 D:/Qt/Tools/mingw730_64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/as.exe: CMakeFiles\opencv_perf_core.dir\perf\opencl\perf_arithm.cpp.obj: too many sections (37620)
 C:\Users\User\AppData\Local\Temp\ccWlqdOA.s: Fatal error: can't close CMakeFiles\opencv_perf_core.dir\perf\opencl\perf_arithm.cpp.obj: File too big
 mingw32-make[2]: *** [modules\core\CMakeFiles\opencv_perf_core.dir\build.make:77: modules/core/CMakeFiles/opencv_perf_core.dir/perf/opencl/perf_arithm.cpp.obj] Error 1
 mingw32-make[1]: *** [CMakeFiles\Makefile2:2712: modules/core/CMakeFiles/opencv_perf_core.dir/all] Error 2
 mingw32-make: *** [Makefile:162: all] Error 2
```
Repository: go
Issue: crypto/tls: safely shutdown
Labels: NeedsInvestigation

<pre>
$ go version
go version go1.11.2 linux/amd64
</pre>

### Does this issue reproduce with the latest release?
Yes

Safely and reliably shutting down an SSL transport while keeping the underlying connection still open is not supported by the API in an intuitive way. I have posted this question on stackoverflow here: https://stackoverflow.com/questions/53825725/how-to-safely-shutdown-ssl-connection

But to repeat the question:

Using Go, how can a tls.Conn be safely shutdown without entirely closing the underlying connection? I have a working solution, but I am not sure if there is a better way.

In my application I have a non-SSL connection that is eventually 'upgraded' to an SSL connection. Then at some point the SSL connection should be closed cleanly, and the connection should return to the non-SSL version (where unencrypted traffic can be sent between the two parties).

```
import "crypto/tls"
func app(connection net.Conn){
   // process some data on the connection, then eventually change it to SSL
   ssl = tls.Client(connection, sslConfig) // sslConfig defined elsewhere
   ssl.Handshake()
   // process data using ssl for a while
   // now shut down SSL but maintin the original connection
   ssl.CloseWrite()
   // at this point we have sent a closeNotify alert to the remote side and are expecting a closeNotify be sent back to us.
   // the only way to read the closeNotify is to attempt to read 1 byte
   b := make([]byte, 1)
   ssl.Read(b)
   // assuming the remote side shut down the connection properly, the SSL transport should be finished

   connection.Read(...) // can go back to the unencrypted connection
}
```
This works because if a closeNotify alert record is received then `c.readRecord` in crypto/tls/conn.go will return an error value, and will not read any bytes (so presumably the `b` byte array could have been any size).

This is a bit confusing from a user's point of view. It would be preferable to have an API like `ssl.Shutdown()` that internally maybe does
```
   c.CloseWrite()
   b := make([]byte, 1)
   c.Read(b)
```
Or maybe there is a better way to cleanly shutdown, but that is for the library writer's to decide.

I realize it is a bit strange to want to shutdown an SSL transport and continue to use the underlying connection but that is the constraint I am working under.

If it is helpful I can provide a small working example.
Repository: TypeScript
Issue: Should warn against invalid typeof expression
Labels: Suggestion,Awaiting More Feedback

<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:**  3.2.2

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:** typeof undefined

**Code**

```ts
// This condition will always return 'false' since the types '"string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '42' have no overlap.
typeof 42 === 42

typeof 42 === undefined

typeof 42 === null
```

**Expected behavior:**

```ts
typeof 42 === undefined

typeof 42 === null
```

Should warn as what `typeof 42 === 42` warns.

**Actual behavior:**

No warnings

**Playground Link:** 
http://www.typescriptlang.org/play/index.html#src=%2F%2F%20This%20condition%20will%20always%20return%20'false'%20since%20the%20types%20'%22string%22%20%7C%20%22number%22%20%7C%20%22bigint%22%20%7C%20%22boolean%22%20%7C%20%22symbol%22%20%7C%20%22undefined%22%20%7C%20%22object%22%20%7C%20%22function%22'%20and%20'42'%20have%20no%20overlap.%0Atypeof%2042%20%3D%3D%3D%2042%0A%0Atypeof%2042%20%3D%3D%3D%20undefined%0A%0Atypeof%2042%20%3D%3D%3D%20null

**Related Issues:** <!-- Did you find other bugs that looked similar? -->
Repository: godot
Issue: Unexpected behavior when setting negative scale in KinematicBody2D
Labels: discussion,topic:physics

**Godot version:**
3.1-4a mono

**OS/device including version:**
Linux Mint 19.1

**Issue description:**
You try to set the scale.x < 0 for KinematicBody2D, RigidBody2D, and (possibly) StaticBody2D from code, scale changes sign to opposite (-1, 1) -> (1, -1); (-1, -1) -> (1, 1). In this case, the scale actually changes, but the resulting scale is not correct.

In the attached project in _Ready, we change the original scale (1, 1) to (-1, -1). The body changes its scale, but the scale in _physics_process is now (1, 1).

**Minimal reproduction project:**
[KinematicScale.zip](https://github.com/godotengine/godot/files/2718309/KinematicScale.zip)
Repository: javascript-algorithms
Issue: Translate to PT-PT
Labels: enhancement

Hello

You have PT-BR  translations. Would you like one PR with PT-PT  ?
Repository: pytorch
Issue: [Caffe2] Internal compiler error for CUDA.
Labels: caffe2

##  Bug

Internal compiler error on Windows with CUDA build.

```
Error: Internal Compiler Error (codegen): "there was an error in verifying the lgenfe output!"

cross_entropy_op.cu
CMake Error at caffe2_gpu_generated_cross_entropy_op.cu.obj.RelWithDebInfo.cmake:279 (message):
  Error generating file
  C:/Users/tolia/AppData/Local/Temp/pytorch/build/caffe2/CMakeFiles/caffe2_gpu.dir/operators/./caffe2_gpu_generated_cross_entropy_op.cu.obj
```
## Environment

 - PyTorch Version (e.g., 1.0): master
 - OS (e.g., Linux): Win10
 - How you installed PyTorch (`conda`, `pip`, source): source
 - Build command you used (if compiling from source): cmake + VS2017 (15.9.4) + Ninja
 - Python version: 3.7
 - CUDA/cuDNN version: 10.0/7
 - GPU models and configuration: Kepler + Pascal (build for Kepler+Maxwell+Pascal+Volta)

## Additional context

Noticed several similar reports: #12117 #14872 #13808 #11203
Repository: terminal
Issue: Recognise Left and Right Shift in KEY_EVENT_RECORD.dwControlKeyState
Labels: Issue-Feature,Product-Conhost,Area-Input

https://docs.microsoft.com/en-us/windows/console/key-event-record-str

wincon.h:
```C++
#define RIGHT_ALT_PRESSED     0x0001 // the right alt key is pressed.
#define LEFT_ALT_PRESSED      0x0002 // the left alt key is pressed.
#define RIGHT_CTRL_PRESSED    0x0004 // the right ctrl key is pressed.
#define LEFT_CTRL_PRESSED     0x0008 // the left ctrl key is pressed.
#define SHIFT_PRESSED         0x0010 // the shift key is pressed.
#define NUMLOCK_ON            0x0020 // the numlock light is on.
#define SCROLLLOCK_ON         0x0040 // the scrolllock light is on.
#define CAPSLOCK_ON           0x0080 // the capslock light is on.
#define ENHANCED_KEY          0x0100 // the key is enhanced.
```

Is it possible to extend it with:
```C++
#define LEFT_SHIFT_PRESSED    0x0200 // the left shift key is pressed.
#define RIGHT_SHIFT_PRESSED   0x0400 // the right shift key is pressed.
```
?

Motivation:
- Symmetry and flexibility.

For compatibility reasons SHIFT_PRESSED (0x0010) should be preserved and set on either Shift key press of course.