sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: TypeScript
Issue: Checking JS types does not accept @implements or @augments on constructor functions
Labels: Suggestion,Awaiting More Feedback

<!--
Please try to reproduce the issue with the latest published version. It may have already been fixed.
For npm: `typescript@next`
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly
-->
**TypeScript Version:**  3.9.5 (also tested on 3.9.3 initially)

**Search Terms:** `@implements`, `jsdoc`

**Code**

```js
/**
 * @param {string} name
 * @implements {EventTarget}
 * @constructor
 */
function Foo (name) {
  this.name = name
}

/**
 * @param {string} type
 * @param {EventListenerOrEventListenerObject} listener
 * @param {boolean | AddEventListenerOptions} [options]
 */
Foo.prototype.addEventListener = function (type, listener, options) {}
```

Then run `tsc --noEmit --checkJS --allowJS reproducer.js`

**Expected behavior:**

According to https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html#constructor-functions-are-equivalent-to-classes, constructor functions are treated like classes. So using `@implements` or `@augments` on them should be possible. It used to work in the past.

**Actual behavior:**

```
reproducer.js:6:10 - error TS8022: JSDoc '@implements' is not attached to a class.

6 function Foo (name) {
           ~~~


Found 1 error.
```

**Playground Link:** I was not able to reproduce this in the playground (but it does not have the latest 3.9 versions available)

**Related Issues:**
Repository: rust
Issue: coercion becomes order dependent for higher-ranked functions
Labels: T-compiler,A-NLL,A-lazy-normalization

https://github.com/rust-lang/rust/pull/72493 revealed an interesting interaction between coercion, the universe transition (https://github.com/rust-lang/rust/issues/56105), and the transition to NLL (https://github.com/rust-lang/rust/issues/57895). What happens in the `old-lub-glb-hr-noteq[12].rs` tests introduced by that PR is:

* We have to compute the "coercion LUB" of `fn('a, 'b) -> 'a` and `fn('a, 'a) -> 'a`. The "correct answer" is `fn('a, 'a) -> 'a`. With NLL migration mode, we get a hard error always, but once we enable the NLL mode, our answer depends on the order of the match arms.
* The reason is that the *coercion code* finds that it can create a subtype for either order, so it produces a result that depends on the ordering. That same code introduces a "equality" requirement in migration mode that results in an error no matter what. But when those errors are suppressed, we generate NLL, and we only enforce subtyping, which either works or doesn't, depending on what type was chosen.

How should we fix this?

* Keep the error? Unfortunate.
* Extend the leak check so it can distinguish these two types correctly and make the coercion code do a "evaluate" that includes a leak check.
Repository: flutter
Issue: [pigeon] provide a toString
Labels: package,team-ecosystem,p: pigeon,P3,triaged-ecosystem

By default, the autogen'ed data classes just return "I/flutter: Instance of 'Book'"

Would be nice to get a better string. Perhaps annotate the fields you want? Or randomly just pick the top 3? Or just print the json?
Repository: TypeScript
Issue: Incorrect autocomplete for "File" class 
Labels: Bug

*TS Template added by @mjbvz*

**TypeScript Version**: 4.0.0-dev.20200607

**Search Terms**
- suggest / suggestions / completions
- dom
- javascript

---

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- Please search existing issues to avoid creating duplicates. -->
<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed: https://code.visualstudio.com/insiders/ -->

<!-- Use Help > Report Issue to prefill these. -->
- VSCode Version: 1.45.1
- OS Version: Windows 10

Steps to Reproduce:

1. New JavaScript file + following code:
```javascript
class File {
    Method() {
    }
}
const file = new File;
file
```
2. Put the dot (`.`) on the last line and wait until the window with suggestions appears.
3. It is expected for the list in the window to has a `Method` member, but it contains a `Blob` class members instead:

![2020-06-04 11_04_18-● class File { • Untitled-1 - Visual Studio Code](https://user-images.githubusercontent.com/65226754/83731528-5d895880-a653-11ea-8101-eb6c9006a90e.png)

It seems that VSCode thinks that it is a `File` class [for web](https://developer.mozilla.org/en-US/docs/Web/API/File):

![2020-06-04 11_02_22-● class File { • Untitled-1 - Visual Studio Code](https://user-images.githubusercontent.com/65226754/83731668-96293200-a653-11ea-9b44-efc61d69b5cb.png)

<!-- Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes
Repository: rust
Issue: Handle source code coverage in const eval
Labels: A-const-eval

One open question around source code coverage instrumentation (#34701 / https://github.com/rust-lang/compiler-team/issues/278) is how to handle code that is only run during const eval. For example:

```rust
const fn compute_foo(x: bool) -> i32 {
  if x {
    42
  } else {
    11
  }
}

#[cfg(test)]
mod tests {
  #[test]
  fn test_foo() {
    assert_eq!(compute_foo(false), 11);
    assert_eq!(compute_foo(true), 42);
  }
}
```

In a coverage report, we don't want the code in `compute_foo` to show as not being covered by tests because it was only "run" at compile time.

# Approaches

I've talked about this with @petrhosek a couple times, he raised two possible approaches for both rustc and clang. I'll do my best to communicate them, but any mistakes are mine.

## Emit a coverage profile at compile time

When code coverage instrumentation is enabled, another option can be specified which causes a profile to be emitted at compile time (in the same format as the profiles generated at runtime). This would include every counter hit while evaluating MIR during const eval. The profile could then be combined with profiles collected during runtime (which I believe tooling already exists for).

One benefit of this approach is that it allows us to handle counters hit at compile time differently from those hit at runtime. I can see this being useful e.g. if we were to use those counters for some kind of PGO pass in the MIR, though I'm not sure if that's a realistic use for them. There might be other reasons to differentiate.

A challenge with the approach is that we'll have to produce the profile format ourselves (we won't get the benefit of LLVM instrumentation doing it for us, like we do in the final binary).

## Initialize runtime counters with compile time counts

Similar to before, we would count how many times each source code coverage region was evaluated during compile time. Instead of emitting a profile at compile time, we can simply initialize the (static) counter in the final binary to this value. So if that counter was evaluated 42 times, every profile emitted by the binary would start at 42 (and go up from there if the same counter were also hit at runtime). We might need to extend LLVM to support something like this.

The main benefit of this is simplicity: there are less "moving parts" for someone who wants to use source code coverage. We also don't have to teach the compiler how to emit coverage profiles.

One possible issue with this approach is how it might interact with linker garbage collection. We wouldn't want the linker to remove nonzero counters for never being referenced from any code in the binary.
Repository: flutter
Issue: Hide platform boilerplate code in Flutter projects
Labels: c: new feature,tool,a: first hour,P3,team-tool,triaged-tool

## Use case

Currently each multi-platform Flutter project contains significant amount of platform boilerplate code. For example, if I have enabled just `Android`, `iOS`, `Web` and `Windows` platforms and run `flutter create myproject` I get `~250K` boilerplate code in `android`, `ios`, `web` and `windows` folders.

All this code generally should be checked in into VCS.

Problems with this approach:
- It is quite hard to modify some platform-specific project settings for each platform. For example, to change project display name user should look into all these folders containing quite complex code especially for non-experts.
- Currently it seems Flutter does not have a good workflow scenario to update this boilerplate code when project templates are updated/improved in Flutter. The only approach I see is to run `flutter create` again and overwrite all this code with new templates. But any changes made here might be lost.
- It is almost impossible to create a new Flutter project "by hand" without `flutter create`.
- The amount of boilerplate code might be much bigger than application code. A `Hello, world` application source code base might become even close to `1 MB` in future if targeted to all supported platforms (Android, iOS, MacOS, Web, Windows, Linux, Fuchsia, etc). 

All these problems might become more important with growing number of supported platforms in Flutter.

## Proposal

The proposal is to hide all platform boilerplate code / project templates in Flutter build tools and provide some cross-platform settings file(s) (maybe just use `pubspec.yaml`?). So a simple application might contain only `main.dart` and `pubspec.yaml` file and problems above will be solved.

This is just a draft proposal and I understand that serious amount of work should be done in Flutter tooling to achieve this. I love Flutter and just hope that this feature might make Flutter better and simplify Flutter learning curve, especially for beginners.
Repository: rust
Issue: TTL should be regarded as octal number (8-bit unsigned integer)
Labels: T-libs-api,C-bug,A-io

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->

I tried this code:

```rust
use std::net::UdpSocket;
fn main(){
    let mut socket = UdpSocket::bind("0.0.0.0:1234").unwrap();
    socket.set_ttl(300);
}
```

I expected to see this happen: I expected that it would raise compilation error because the `ttl` is octal and [maximum value is 255](https://en.wikipedia.org/wiki/Time_to_live). But I could set 300 as ttl. 

Instead, this happened: It does not raise any error and I could send packet with ttl more than 255. It was causing trouble as my software was setting ttl greater than 255 and was providing wrong data.
Upon looking more into the source code and documentation, it seems like `set_ttl` method is taking 32-bit unsigned integer type `u32` as ttl, where is should take 8-bit unsigned integer type `u8` as ttl.

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc 1.43.1 (8d69840ab 2020-05-04)
binary: rustc
commit-hash: 8d69840ab92ea7f4d323420088dd8c9775f180cd
commit-date: 2020-05-04
host: x86_64-apple-darwin
release: 1.43.1
LLVM version: 9.0
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary>Backtrace</summary>
<p>

```
<backtrace>
```

</p>
</details>
Repository: flutter
Issue: Material widget breaks the semantics inside it when used with elevation
Labels: framework,f: material design,a: accessibility,has reproducible steps,P2,found in release: 3.3,found in release: 3.5,team-design,triaged-design

Internal: b/157889018

Material's elevation affects Semantics boundaries. See the following repro:

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Column(
        children: <Widget>[
          Material(
            elevation: 1,
            child: Container(
              height: 50,
              width: double.infinity,
              color: Colors.yellow,
              child: Row(
                children: <Widget>[
                  Semantics(
                    label: 'Close icon',
                    child: Icon(Icons.arrow_back_ios),
                  ),
                  Expanded(
                    child: Container(
                      color: Colors.blue,
                    ),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}
```

If elevation is set to a non-0 value, semantics wrapper covers the entire Material:

![02](https://user-images.githubusercontent.com/6687929/84107726-463fc780-a9d3-11ea-8eb7-d843e5830b2a.png)

If elevation is set to 0, the semantics wrapper "close icon" only covers the Icon itself, as expected:

![02](https://user-images.githubusercontent.com/6687929/84107781-72f3df00-a9d3-11ea-81d2-d330bf0dfcdf.png)
Repository: pytorch
Issue: [doc] [distributed] example of specifying url etc in url
Labels: oncall: distributed,module: docs,triaged

The only mention of this in the doc is 
https://github.com/pytorch/pytorch/blob/0251ba61089795a7a27c0473e4bb022805432c1f/torch/distributed/distributed_c10d.py#L337-L341
with no example. 

cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @xush6528 @osalpekar @jlin27
Repository: pytorch
Issue: [distributed] calling nccl reduce with inconsistent dst hangs
Labels: oncall: distributed,triaged,module: nccl,module: deadlock

Not sure if intended or avoidable, but if `dst` is inconsistent across ranks, `reduce` finishes, but future kernels seems to hang. E.g.,
```py
import torch
torch.distributed.init_process_group('nccl', init_method='tcp://localhost:10402', world_size=2, rank=0)
x = torch.zeros(3, device=0)
torch.distributed.reduce(x, 0, torch.distributed.ReduceOp.SUM)
print(x)
```

```py
import torch
torch.distributed.init_process_group('nccl', init_method='tcp://localhost:10402', world_size=2, rank=1)
x = torch.zeros(3, device=1)
torch.distributed.reduce(x, 1, torch.distributed.ReduceOp.SUM)
print(x)
```

cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @xush6528 @osalpekar
Repository: pytorch
Issue: Do not modify global random state
Labels: module: docs,triaged,module: random

## 🚀 Feature

Currently, the [recommended approach to achieve reproducibility](https://pytorch.org/docs/stable/notes/randomness.html) is setting global random seeds. I would like to propose that instead all functions which need a random source accept a local, non-global, `random_seed`/`random_state` argument to which one can pass a random state object, or numpy generator, or something else, which binds random source locally.

## Motivation

Reproducibility if often needed in ML programs. But current approach of setting global random seed in various places in pytorch is suitable only for small programs which are using only pytorch. Now imagine that you have many libraries around, each trying to set global random seed at various times. This can lead to strange changes in random seeds just because you swapped two calls around. Moreover, if any of those libraries stand-alone produces a sequence of numbers, it might be that when used in combination with pytorch the sequence is not anymore the same. So if you are trying to compare two different implementations (one in pytorch one in some other library), the behavior of the implementation in the other library can change just because you also have pytorch around.

Of course, the other library should also not be using global random source. But ideally pytorch should not either.

In our concrete case, we have an AutoML system generating many candidate pipelines using primitives to build those pipelines which in turn use many different libraries. Those pipelines are run and we hope to have full reproducibility (which helps with metalearning). But setting/resetting global random seed just because one primitive in one candidate pipeline we are exploring happens to use pytorch influences behavior of unrelated pipelines.

## Pitch

Instead of relying on global random sources, add `random_state` parameter to all functions which expect/use randomness. Do not ever set random seed of a global random source in pytorch code (the user of pytorch can do that themselves if they really want).

## Alternatives

Use context managers to set and reset random seeds, but this becomes tricky when using multi-threading.

## Additional context

See example in [sklearn](https://scikit-learn.org/stable/glossary.html#term-random-state).

cc @jlin27 @pbelevich
Repository: angular
Issue: Validators.pattern anchoring doesn't work as expected
Labels: help wanted,area: forms,state: confirmed,forms: validators,P4

## 🐞 bug report

### Affected Package
The issue is caused by package @angular/forms.

### Is this a regression?
I don't think so.

### Description
When [Validators.pattern](https://github.com/angular/angular/blob/55979fe0ae91a2e5306050d008b0173a491e53b9/packages/forms/src/validators.ts#L380) accepts a string, it tries to find out whether the pattern is anchored at each end and if not, it prepends/appends `^`/`$`  as appropriate.  While I don't agree with this magic, this issue is not about the presence of such behavior, but about its correctness.  The correct way to anchor a regular expression also includes **enclosing the contents in a subexpression**, which the current algorithm doesn't do.

[MDN says about [pattern]](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern):
> The pattern's regular expression, when matched against the value, must have its start anchored to the start of the string and its end anchored to the end of the string, which is slightly different from JavaScript regular expressions: in the case of pattern attribute, we are matching against the entire value, not just any subset, as if  a `^(?:` were implied at the start of the pattern and `)$` at the end.

## 🔬 Minimal Reproduction
https://stackblitz.com/edit/angular-ivy-j258mq

Although pattern is `yes|no`, other values like `yes, and...`, `lol, no` etc. are considered valid by Angular.


## 🌍  Your Environment

**Angular Version:**
<pre><code>
angular-cli: 1.0.0-beta.28.3
node: 10.20.1
os: win32 x64
@angular/animations: 7.2.15
@angular/cdk: 7.3.7
@angular/common: 7.2.15
@angular/compiler: 7.2.15
@angular/core: 7.2.15
@angular/forms: 7.2.15
@angular/platform-browser: 7.2.15
@angular/platform-browser-dynamic: 7.2.15
@angular/router: 7.2.15
</code></pre>
Repository: youtube-dl
Issue: --pause-on-error & extension of --abort-on-error
Labels: request

- [x] I'm reporting a feature request
- [x] I've verified that I'm running youtube-dl version **2020.06.06**
- [x] I've searched the bugtracker for similar feature requests including closed ones

There is an option called `--abort-on-error`. 

We want something like `--abort-on-error x`. Where x is the number of errors after which `youtube-dl` will quit.

What we also need is `--pause-on-error y` which will pause on error for y minutes. 

The ultimate goal is to pause for y minutes after each error. If the error keeps occurring for x times then exit youtube-dl.
Repository: deno
Issue: Fetch returns: Error trying to connect: Connection reset by peer (os error 54)
Labels: bug,web

`let a = await fetch('https://pictures.vwe.nl');
console.log(a)`

Returns "Error trying to connect: Connection reset by peer (os error 54)"

`deno --version`
- deno 1.0.5
- v8 8.4.300
- typescript 3.9.2
Repository: pytorch
Issue: User Objects aren't recursively scripted as nn.Module attributes
Labels: oncall: jit,triaged

I am ready convert a pytorch module to ScriptModule, and then load it in c++，but i am blocked by this error `This attribute exists on the Python module, but we failed to convert Python type: 'Vocab' to a TorchScript type`, the `Vocab` is a python object i define. the demo code is here:
   
    import torch
    class Vocab(object):
        def __init__(self, name):
            self.name = name

        def show(self):
            print("dict:" + self.name)

    class Model(torch.nn.Module):
        def __init__(self, ):
            super(Model, self).__init__()
            self.layers = torch.nn.Linear(2, 3)
            self.encoder = 4
            self.vocab = Vocab("vocab")

        def forward(self, x):
            name = self.vocab.name
            print("forward show encoder:" + str(self.encoder))
            print("vocab:" + name)
            enc_hidden = []
            step = len(x) // 2
            for i in range(step):
                enc_hidden.append((x[2*i] + x[2*i + 1])/2)
            enc_hidden = torch.stack(enc_hidden, 0)
            enc_hidden = self.__show(enc_hidden)
            return self.layers(enc_hidden)

        @torch.jit.export
        def __show(self, x):
            return x + 1

    model = Model()
    data = torch.randn(10, 2)
    script_model = torch.jit.script(model)
    print(script_model)
    r1 = model(data)
    print(r1)
the error msg:

    Traceback (most recent call last):
      File "/mnt/d/python_projects/pytorch_deploy/model4.py", line 47, in <module>
        script_model = torch.jit.script(model)
      File "/mnt/d/anaconda3/lib/python3.6/site-packages/torch/jit/__init__.py", line 1261, in script
        return torch.jit._recursive.create_script_module(obj, torch.jit._recursive.infer_methods_to_compile)
      File "/mnt/d/anaconda3/lib/python3.6/site-packages/torch/jit/_recursive.py", line 305, in create_script_module
        return create_script_module_impl(nn_module, concrete_type, stubs_fn)
      File "/mnt/d/anaconda3/lib/python3.6/site-packages/torch/jit/_recursive.py", line 361, in create_script_module_impl
        create_methods_from_stubs(concrete_type, stubs)
      File "/mnt/d/anaconda3/lib/python3.6/site-packages/torch/jit/_recursive.py", line 279, in create_methods_from_stubs
        concrete_type._create_methods(defs, rcbs, defaults)
     RuntimeError: 
      Module 'Model' has no attribute 'vocab' (This attribute exists on the Python module, but we failed to convert Python type: 'Vocab' to a TorchScript type.):
      File "/mnt/d/python_projects/pytorch_deploy/model4.py", line 26
      def forward(self, x):
        name = self.vocab.name
           ~~~~~~~~~~ <--- HERE
        print("forward show encoder:" + str(self.encoder))
        print("vocab:" + name)
so how can i use my own python object in torchscript?


cc @suo
Repository: flutter
Issue: Long Running Isolates / FFI Calls Break Hot Reloading -> willReassemble Method Needed
Labels: engine,dependency: dart,has reproducible steps,P2,found in release: 3.7,found in release: 3.8,team-engine,triaged-engine

I'm writing a Flutter Plugin which starts long-running C-Functions inside an isolate via FFI. The problem: Hot reloading is broken as long as the C function is executed. 

I could easily stop the C function before executing the hot reload. To do this a callback informing me of an **upcoming** hot reload is needed. Currently, I can override [`reassemble`](https://api.flutter.dev/flutter/widgets/State/reassemble.html) as stated at [StackOverflow](https://stackoverflow.com/questions/55281077/how-to-detect-hot-reload-inside-the-code-of-a-flutter-app). But this function is only called after a hot reload, not before. 

In addition to the `reassemble` method, we need a `willReassemble` method informing us about an upcoming hot reload. I can then stop my long-running isolate.

Check out the example flutter plugin demonstrating the issue: 
https://github.com/gatzsche/flutter-dart-ffi-hotreload-issue