sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: TypeScript
Issue: Type of function field of union object types not inferred correctly when infer is based on undefined type
Labels: Bug

**TypeScript Version:**  3.7.x-dev.201xxxxx

<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
**Search Terms:**
union types, react prop union object type, union type infer
**Code**
```ts
import React from 'react'

type Props = {
  name: string;
} & (
  | { isValid: true, onChange?: (valid: true) => void }
  | { isValid?: false, onChange?: (valid: false) => void }
)

const a: Props = {
    name: "Eddie",
    isValid: true,
    onChange: (e) => {
        // type of e is true ✅
    }
}

const b: Props = {
    name: "Eddie",
    isValid: false,
    onChange: (e) => {
        // type of e is false ✅
    }
}

const c: Props = {
    name: "Eddie",
    onChange: (e) => {
        // type of e is any ❌
    }
}
```

[Playground Link](https://www.typescriptlang.org/play?ts=3.9.0-beta#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wChSYBPMJOABRzAGc4BeOAb1LjgDsUQSAFxwmMKMF4BzANykAvnABkcABTc4AH05xgTAGooANsAAmI8QFckAGjgReAYQAWKaUgD8I1QDdjZiyhrAEo2AD44HwgzOHkNbQ5dA39TLzhMYyZbeydXdzTfFJEMoyzQ1giomLjg8jQHMTgUEQYIZjZODR5+QREAIgBRU1NgJD6bLqTDE3M4K1tJhxc3KWE1JHKIrh4dnYB6PbnqWghMOFo9OaDaQFBySbi40nreRoAjFsYWdm2dnrXB4ajcaTPTTALpTILXZLPKrbwbcKdXa7A5HGj2M4XFglLJwO67B51BrwNAfNpfJG-AT-IYjMYTaG5FZrVQIiqU5FwVFUdGnc5JJq8ShwQAy5PcFOQgA)

**Expected behavior:**
Typescript infers the type of the `e` argument correctly.
It works without a problem when the inferred value is not a function.
like this example: [Playground Link](https://www.typescriptlang.org/play?ts=3.9.0-beta#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgcilQ3wChSYBPMJOABRzAGc4BeOAb1LjgDsUQSAFxwmMKMF4BzANykAvnABkcABTc4AH05xgTAGooANsAAmI8QFckAGjgA3Y2YtRrceRu0ddBp6YD8IpjGTLYOfoFwwUah7qQAlORoELxicCgiDBDMbJwaPPyCIgBEAKKmpsBIxTb5PoYm5nBWtnWOjS5uAPRdcA1mogAWEJZGpnAARrQtcICg5ApJKWkTmYws7Fw8BQLCcGUVVTV1ev1N0aG1W+EdUSG0PX1+QyNjk7TntPMepMmp8GirbLrPJXQq7faVaqXLbtZy3GL3XqnZ6jcZTeGxL7kIA)

**Actual behavior:**
Typescript infers the type of the `e` argument as any.
Repository: godot
Issue: Godot generates PVRTC-compressed texture with all zeros
Labels: bug,platform:ios,topic:editor,topic:porting,topic:import

**Godot version:**
Godot 3.2.2.beta1

**OS/device including version:**
MacOSX 10.14.6 (18G95)

**Issue description:**
Set texture VRAM compressed, enable pvrtc compression. Reimport texture, after GDST header it contains only zeros.

Original file:
![background](https://user-images.githubusercontent.com/1177068/79743861-041cd280-830e-11ea-8804-b4732dd2168c.png)

Compressed file:

[background.png-14973fd1de8b151436931643db6aa461.pvrtc.stex.zip](https://github.com/godotengine/godot/files/4502921/background.png-14973fd1de8b151436931643db6aa461.pvrtc.stex.zip)


**Steps to reproduce:**

**Minimal reproduction project:**
Repository: ant-design
Issue: Modal的静态方法在ShadowDOM中按钮点击无效
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.

### What problem does this feature solve?
Modal的静态方法在ShadowDOM中按钮点击无效

DEMO：[https://chuyb.csb.app/](https://chuyb.csb.app/)

代码：[https://codesandbox.io/s/shadowdom-antd-modal-func-chuyb](https://codesandbox.io/s/shadowdom-antd-modal-func-chuyb)

### What does the proposed API look like?
1. 修改confirm.tsx，提供全局设置getContainer方法
```javascript
// 提供全局设置getContainer方法
let funcConfig: ModalFuncProps;
export const setFuncConfig = (config: ModalFuncProps) => {
    funcConfig = config;
}
```

修改index.tsx，增加静态方法setFuncConfig
```javascript
Modal.setFuncConfig = setFuncConfig;
```

2. 修改confirm.tsx，修改confirm中渲染容器div的获取方式
```javascript
function getFuncContainer(containerFn: GetContainer) {
  let funcContainer: HTMLElement = containerFn as HTMLElement;
  if (typeof containerFn === 'function') {
    funcContainer = containerFn();
  } else if (typeof containerFn === 'string') {
    funcContainer = document.querySelector(containerFn);
  }
  return funcContainer;
}

export default function confirm(config: ModalFuncProps) {
  // eslint-disable-next-line no-use-before-define
  let currentConfig = { ...funcConfig, ...config, close, visible: true } as any;

  const div = document.createElement('div');
  const containerFn = currentConfig.getContainer;
  if (containerFn) {
    const root: HTMLElement = getFuncContainer(containerFn);
    root.appendChild(div);
  } else {
    document.body.appendChild(div);
  }
```


<!-- generated by ant-design-issue-helper. DO NOT REMOVE -->
Repository: TypeScript
Issue: Feature Request: In JS, check if the non-widened type of an object property satisfies type constraints
Labels: Suggestion,In Discussion

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker.

Please help us by doing the following steps before logging an issue:
  * Search: https://github.com/Microsoft/TypeScript/search?type=Issues
  * Read the FAQ, especially the "Common Feature Requests" section: https://github.com/Microsoft/TypeScript/wiki/FAQ

-->

## Search Terms
javascript as const, expando literal

## Suggestion

I am providing declaration files that are mainly consumed by JS projects. The API I'm writing these declaration files for is very strict in what it accepts and I am mirroring that in the declarations. Users often stumble across assignments that seem perfectly valid, but are not accepted by TypeScript. The reason is the widening from literal types to `string`. 

Here's a (dumbed down) example:
```js
/** @param {{prop1: "a" | "b"}} arg */
function foo(arg) {}

const arg = {};
arg.prop1 = "a";
foo(arg); // error here: string is not compatible with "a" | "b".

const arg2 = {
	prop1: "b"
};
foo(arg2); // Also an error
```

While in TypeScript, I can just put `as const` behind the assignment, there's no such thing in JS. Therefore I propose that when type-checking such constructs, the implicit literal type (here: `prop1: "a"`, resp. `prop1: "b"`) is taken into account.

## Use Cases

Simplifying usage of strictly-typed libraries from JavaScript. Many JS users don't know what to do with those kinds of error messages and assume that there's a bug in the library or type definitions.

## Examples

Here's how it could work:
```js
const arg2 = {
	prop1: "b"
};
foo(arg2); // should be fine, arg2.prop1 should be considered as literal `"b"` for this call

arg2.prop1 = "a";
foo(arg2); // should still be fine, CFA should know that prop1 is of type `"a"`

arg2.prop1 = someFunctionThatReturnsString();
foo(arg2); // should be an error, since prop1 can now be any string

arg2.prop1 = "a";
foo(arg2); // should be fine again, since the last assignment was the literal `"a"`
```

## Checklist

My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code - **It would change existing behavior, but I would argue it is not breaking.**
* [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, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).
Repository: rust
Issue: Fields should not alias Vec content.
Labels: A-LLVM,I-slow,C-enhancement,A-codegen,T-compiler,C-optimization

I tried this code ( https://rust.godbolt.org/z/GuvQi9 ), which mutates a field while reading the content of a buffer.

```rust
use std::vec::Vec;

pub fn foo(v: &mut Vec<usize>) -> usize {
    assert!(v.len() > 2);
    let s1 = v.pop().unwrap();
    let s2 = v.pop().unwrap();
    s1 + s2
}
```

Here the assertion is capable of removing the branches which are within the `pop` function, to make a branch-less function apart from the assertion code:

```
        […]
        mov     rcx, qword ptr [rdi + 16]
        […]
        lea     rax, [rcx - 1]
        mov     qword ptr [rdi + 16], rax
        […]
        lea     rsi, [rcx - 2]
        mov     qword ptr [rdi + 16], rsi
        […]
```

However, the generated code still contains a spill of the `len` field of the vector for each pop-ed value which is used. The reason is that LLVM does not know whether the read type can alias or not the field which is being written to. This aliasing reason is inconsistent with the fact that the `len` field from which the value which is written back to memory is aliased in the `rcx` register.

I would have expected the generated code to contain a single update of the `len` field, instead of 2.

Testing with `-C opt-level=3` does not change the result.

### Meta
Tested with both `rustc --version --verbose`:
```
rustc 1.42.0 (b8cedc004 2020-03-09)
binary: rustc
commit-hash: b8cedc00407a4c56a3bda1ed605c6fc166655447
commit-date: 2020-03-09
host: x86_64-unknown-linux-gnu
release: 1.42.0
LLVM version: 9.0
```

and

```
rustc 1.44.0-nightly (7f3df5772 2020-04-16)
binary: rustc
commit-hash: 7f3df5772439eee1c512ed2eb540beef1124d236
commit-date: 2020-04-16
host: x86_64-unknown-linux-gnu
release: 1.44.0-nightly
LLVM version: 9.0
```

edit: remove the `-Zmutable_noalias` as this seems to optimize this minimized test case. https://github.com/rust-lang/rust/issues/71354#issuecomment-617105118
Repository: scrcpy
Issue: package h264 output as video capture device for use by other apps
Labels: feature request,webcam

I would like to use scrcopy output in other apps, as video capture device. For example this would allow to use instagram app video effects camera and then feed it to skype, zoom, twitch, obs, etc.

There is already part of the solution (as I see it, could be wrong of course) in ws-scrcopy fork (websocket server). Maybe could process it with v4l2loopback tools to make virtual "videocam" in linux. 

unfortunately do not know of similar library in windows. but there are windows apps, e.g. xsplit-vcam or chromacam - which create such devices on windows too. but there is a code for obs plugin that simulates virtual webcam under Windows. https://github.com/CatxFish/obs-virtual-cam

![image](https://user-images.githubusercontent.com/13075980/79759741-bdd46d00-8327-11ea-912e-7e0afaf18a79.png)

![image](https://i.ytimg.com/vi/ns8IXRTw9PI/maxresdefault.jpg)
Repository: terminal
Issue: "Peek" button to show screen behind Terminal
Labels: Area-UserInterface,Area-Extensibility,Product-Terminal,Issue-Task


I'd like a **Peek** button on the TitleBar near the new tab **`+`** button or the minimize **`-`** button, just like Aero Peek.

If you guys are redoing the composition work then please consider adding it to the TitleBar. So that when I hover over it, I can see the screen behind, rather than staying transparent all the time.


_Originally posted by @Nirmal4G in https://github.com/microsoft/terminal/issues/603#issuecomment-615954708_
Repository: flutter
Issue: Flutter Engine compile flag -fno-c++-static-destructors
Labels: c: crash,engine,dependency: skia,customer: bytedance,P2,team-engine,triaged-engine

We met some crashes when the user killed the app. For example:

```
Thread 34: Crashed
0   Flutter                         0x000000010bffbe9c _OUTLINED_FUNCTION_6905 (in Flutter) (SkFontHost_mac.cpp:2483)
1   Flutter                         0x000000010bdffd64 create_from_CTFontRef(std::__1::unique_ptr<__CTFont const, SkFunctionWrapper<void, void const, &(CFRelease)> >, std::__1::unique_ptr<void const, SkFunctionWrapper<void, void const, &(CFRelease)> >, std::__1::unique_ptr<SkStreamAsset, std::__1::default_delete<SkStreamAsset> >) (in Flutter) (SkFontHost_mac.cpp:782)
2   Flutter                         0x000000010be01398 create_from_desc(__CTFontDescriptor const*) (in Flutter) (SkFontHost_mac.cpp:809)
3   Flutter                         0x000000010be016c4 SkFontStyleSet_Mac::createTypeface(int) (in Flutter) (SkFontHost_mac.cpp:2449)
4   Flutter                         0x000000010bf17318 txt::FontCollection::CreateMinikinFontFamily(sk_sp<SkFontMgr> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) (in Flutter) (font_collection.cc:218)
5   Flutter                         0x000000010bf16578 txt::FontCollection::FindFontFamilyInManagers(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) (in Flutter) (font_collection.cc:193)
```

At the same time the main thread stacktrace is:

```
Thread 0 name:  com.apple.main-thread
Thread 0: 
1   libsystem_c.dylib               0x0000000210d04bb4 ___cxa_finalize_ranges (in libsystem_c.dylib) + 384
2   libsystem_c.dylib               0x0000000210d04ec4 _exit (in libsystem_c.dylib) + 24
3   UIKitCore                       0x000000023dca6fec -[UIApplication terminateWithSuccess] (in UIKitCore) + 0
```

![image](https://user-images.githubusercontent.com/11627283/79761309-d490b900-8353-11ea-8bd6-9298e3848c5a.png)
I think the reason is that 'SkTypefaceCache' has been destructed in main thread while the ui thread continue use it.
So maybe:
1. Add '-fno-c++-static-destructors' to the compile flag
2. Or stop the child thread when the app is going to be killed by the user?
Maybe I miss something，hope to get suggestions from the Flutter team.
Repository: pytorch
Issue: Multiprocess DataLoader with DLPack conversion sometimes corrupts memory
Labels: module: multiprocessing,module: serialization,triaged,module: xnnpack

## 🐛 Bug

See the reproduction below for a minimal example.

## To Reproduce

```python
import torch
from torch.utils.data import Dataset, DataLoader
from torch.utils.dlpack import to_dlpack, from_dlpack

def collate(a):
    a = torch.LongTensor(a)
    acap = to_dlpack(a)
    b = from_dlpack(acap)
    assert(torch.equal(a, b))    # passes

    return a, b

loader = DataLoader(dataset=[i for i in range(10000)],
                        batch_size = 2000,
                        collate_fn=collate,
                        shuffle=True,
                        num_workers=10)

for i, (a, b) in enumerate(loader):
    assert torch.equal(a, b)    # fails
```
The test fails.

**[EDIT]** It only fails in the for loop outside the collate function; the test inside the collate function always passes.

## Expected behavior

The test should pass.

## Environment

 - PyTorch Version (e.g., 1.0): 1.4.0 Release
 - OS (e.g., Linux): Linux
 - How you installed PyTorch (`conda`, `pip`, source): pip
 - Build command you used (if compiling from source):
 - Python version: 3.7
 - CUDA/cuDNN version: 10.1
 - GPU models and configuration: GeForce GTX 1070
 - Any other relevant information:

## Additional Information

The code works when multiprocessing is turned off (i.e. `num_workers=0`).

The bug also appears randomly (but not rarely).

cc @SsnL
Repository: pytorch
Issue: JIT string ops and other miscellaneous ops probably shouldn't be in aten namespace
Labels: triage review,oncall: jit,triaged

Self explanatory. It would be bc breaking to renamespace them but I feel that things that are not tensor operations shouldn't be dunked in the aten namespace.

When we ever renamespace aten to torch, that would be a good opportunity to fix the namespace on these operators too.

cc @suo
Repository: node
Issue: flaky test-dgram-multicast-ssmv6-multi-process on linux
Labels: dgram,flaky-test

examples of failure from the last weeks masters:

- https://ci.nodejs.org/job/node-test-commit-custom-suites-freestyle/13723/
- https://ci.nodejs.org/job/node-test-commit-custom-suites-freestyle/13706/
- https://ci.nodejs.org/job/node-test-commit-custom-suites-freestyle/13640/
- https://ci.nodejs.org/job/node-test-commit-custom-suites-freestyle/13516/

```console
Error Message
[PARENT] sent "First message to send" to ff3e::1234:15000
[PARENT] sent "Second message to send" to ff3e::1234:15000
[PARENT] sent "Third message to send" to ff3e::1234:15000
[PARENT] sent "Fourth message to send" to ff3e::1234:15000
[PARENT] sendSocket closed
[PARENT] Responses were not received within 5000 ms.
[PARENT] Fail
assert.js:142
  throw err;
  ^

AssertionError [ERR_ASSERTION]: Failed
    at Timeout._onTimeout (/home/iojs/build/workspace/node-test-commit-custom-suites-freestyle/test/internet/test-dgram-multicast-ssmv6-multi-process.js:140:12)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: undefined,
  expected: undefined,
  operator: 'fail'
}
```
Repository: flutter
Issue: getPositionForOffset (and maybe getBoxesForRange) on canvas benchmark broken?
Labels: framework,engine,c: performance,a: typography,platform-web,team: benchmark,P2,team-web,triaged-web

The `text_canvas_layout` benchmark seems to change the amount of work it performs per iteration as the benchmark progresses. `getPositionForOffset` is affected for both `single_line` and `multi_line` modes:

![getPositionForOffset](https://user-images.githubusercontent.com/211513/79771119-36650a80-82e3-11ea-8985-f0dc09d0d351.png)

![multi_line-getPositionForOffset](https://user-images.githubusercontent.com/211513/79771282-6dd3b700-82e3-11ea-89a6-fafe50b2311c.png)

Most runs of `getBoxesForRange` look OK, e.g.:

![getBoxesForRange-OK](https://user-images.githubusercontent.com/211513/79771501-ba1ef700-82e3-11ea-96d5-3ee7550355fe.png)

However, there are runs (particularly `multi_line`) that either have extremely long warm-up period, or are affected by a similar bug to the one affecting `getPositionForOffset`:

![getBoxesForRange-strange](https://user-images.githubusercontent.com/211513/79771715-036f4680-82e4-11ea-92fc-0ebf0e0413fd.png)

/cc @mdebbar
Repository: pytorch
Issue: Pull hacked twins out of prim ops
Labels: oncall: jit,triaged

Special-cased codegen for 4 ops to handle optional tensors in JIT is replaced temporarily with handwritten bindings in https://github.com/pytorch/pytorch/pull/36666. These need to be removed ASAP; they're vulnerable to drift from the `native_functions` bindings they were originally derived from. 

cc @suo
Repository: godot
Issue: Amkette Evo Gamepad Pro 2 controller for android is reporting wrong values for axis
Labels: bug,platform:windows,topic:input

**Godot version:**
Godot 3.2.1

**OS/device including version:**
Windows 10 Pro

**Issue description:**
Amkette Evo Gamepad Pro 2 controller for android is reporting wrong values for joypad axis, I have an Xbox one controller which works just fine.

**Steps to reproduce:**
Connect Amkette Evo Gamepad Pro 2 controller to android and try adding axis input in Input Map and check the values for left and right analog joystick

**Minimal reproduction project:**
Repository: rust
Issue: Regression in usable type complexity: overflow representing the type `...`
Labels: I-crash,P-medium,T-compiler,regression-from-stable-to-stable,C-bug

I tried building [the iron example of typed-html](https://github.com/bodil/typed-html/tree/master/examples/iron) (version 810fc820, but it's not changing frequently) the code is heavy with (partially recursive) generic types.

With the latest beta (1.43) or stable (1.42), builds succeed; with nightly, they fail with:

```
$ cargo +nightly build --verbose
[...]
error: overflow representing the type `std::option::Option<&T>`

error: aborting due to previous error

error: could not compile `typed-html`.

Caused by:
  process didn't exit successfully: `rustc --crate-name typed_html --edition=2018 typed-html/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=d47a854ad488ad21 -C extra-filename=-d47a854ad488ad21 --out-dir /tmp/typed-html/target/debug/deps -C incremental=/tmp/typed-html/target/debug/incremental -L dependency=/tmp/typed-html/target/debug/deps --extern htmlescape=/tmp/typed-html/target/debug/deps/libhtmlescape-93c9e1d0e3ad1b35.rmeta --extern language_tags=/tmp/typed-html/target/debug/deps/liblanguage_tags-25ca56886cd3e2ae.rmeta --extern mime=/tmp/typed-html/target/debug/deps/libmime-c67f239ef9444378.rmeta --extern proc_macro_hack=/tmp/typed-html/target/debug/deps/libproc_macro_hack-6271c07fb42254ec.so --extern proc_macro_nested=/tmp/typed-html/target/debug/deps/libproc_macro_nested-a84f2a4ba9005aa7.rmeta --extern strum=/tmp/typed-html/target/debug/deps/libstrum-13ea7f88aaf14180.rmeta --extern strum_macros=/tmp/typed-html/target/debug/deps/libstrum_macros-5e348577b435118e.so --extern typed_html_macros=/tmp/typed-html/target/debug/deps/libtyped_html_macros-3ce45005b6c7b859.so` (exit code: 1)
```

The iron example is comparatively simple typed-html usage. I've originally observed the same kind of regression in a [game](https://gitlab.com/chrysn/bloodweb) that uses typed-html.

### Meta

This might be an occurrence of #32498; the behavior changing from stable/beta to nightly indicates a new issue and is thus reported anew.

`rustc +nightly --version --verbose`:
```
rustc 1.44.0-nightly (dbf8b6bf1 2020-04-19)
binary: rustc
commit-hash: dbf8b6bf116c7bece2987ff4bd2792f008a6ee77
commit-date: 2020-04-19
host: x86_64-unknown-linux-gnu
release: 1.44.0-nightly
LLVM version: 9.0
```
(Running with RUST_BACKTRACE does not change the output.)

### Bisection results

I'm running `cargo bisect-rustc` on the code, which has narrowed it down to a regression in nightly-2020-04-10. I'll update this with a more detailled bisection result when it's ready, but that might be a while.
Repository: svelte
Issue: component with transition directive didn't update correctly when store updated 
Labels: bug,temp-stale

**Describe the bug**

When store get updated, I found component with transition directive won't update. It only happens when:

* `store.update()` inside Promise `then()` block, if I move `store.update()` call to outside, it works as expected.
* transition directive was added in component.

**To Reproduce**

[demo](https://svelte.dev/repl/421b79b111344633a5f5fbda0b1c2b5f?version=3.20.1)

1. click `tab2` button, text should be updated to `Hello Tab2` (can check console for store detail)
2. click `tab1` button again
3. click `tab2` button again, it now updates.

### work around

* go to `Title.svelte`, remove `transition:fade`, rerun it
* move store.update() outside of `then()`, rerun it.

**Expected behavior**
text should be updated.

**Severity**
small.
Repository: flutter
Issue: Animate FAB in NavigationRail
Labels: c: new feature,framework,a: animation,f: material design,c: proposal,P2,team-design,triaged-design

Floating Action Buttons will normally animate in/out when added or removed from a Scaffold. When used in a NavigationRail, they disappear / appear instantly. 

## Proposal

Make the FAB animated when used in a NavigationRail

![ED61642D-9AEF-4095-9B6D-0AC943E1FC62-2639-00018198A6B63A94](https://user-images.githubusercontent.com/1145719/79786200-e47baf00-82f9-11ea-8dcb-91dc5b6e318f.gif)

cc: @clocksmith