sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: TypeScript
Issue: Switch statement over a union of literals is not exhaustive when checking against enum members
Labels: Suggestion,Help Wanted,Experience Enhancement

# Bug Report

The following switch-case is unexpectedly not exhaustive:
```ts
enum X {
    FOO = "foo",
    BAR = "bar"
}

function test(x: "foo" | "bar") {
    switch (x) {
        case X.FOO:
            return x;
        case X.BAR:
            return x;
    }
}
```

Because X.FOO and X.BAR are just strings under the hood, I would expect this to compile as exhaustive. It's doubly surprising because:
* Typescript correctly narrows the type of `x` within each case branch
* this works if I check directly against the string literals or a const object (e.g. `const XConst = { FOO: "foo", BAR: "bar" } as const`)

### 🔎 Search Terms

switch union literals exhaustive enum

### 🕗 Version & Regression Information

- This is the behavior in every version I tried, and I reviewed the FAQ for entries about enum, literals, switch statements, type narrowing

### ⏯ Playground Link

[Playground link with relevant code](https://www.typescriptlang.org/play?ts=5.0.3#code/KYOwrgtgBAGlDeAoKKoDEDyGoF4oCIAzAe2PwBplUAhAQQCVcCAjAQwCd9EBfRRAY2IgAzgBdYAYSFimSVOiwAuAiTKV5desvxtOPKK2FRBI0QG4+AektQAJsWBGQxcYIgAHAJYAbYIkJgIPyinkJQoo6iABQAHtqq+FAAPiwc+ACUCFQowgDunqL8ABZQsZly8qj8hsCwAHSYGIrZlfLswKJg7CBQMRatKNXCtTB1ms0Dle2d3b39qLy8iNbGxB4+jv6BwaE9EWIATLHKMOUteQXFpTFnk0MjDUotk9NdPX3PVTX145+tr7MPvJFlYbG4vL5hFsgiEwvtRABmY4qUiJFI6NK3VAXQolMpZO7fIioiaTVAA97zVr3VKcUlkqAUuYtEHLMFrCGbAIw3bhSIAFmRxLIyVpGQJ2PyuOuWOp3xgUlMjyafymHTezMJw0k0lEYwY9LJTKBCx4fCAA)

### 💻 Code

```ts
enum X {
    FOO = "foo",
    BAR = "bar"
}

const XConst = {
    FOO: "foo",
    BAR: "bar"
} as const;

// does not compile
function test(x: "foo" | "bar") {
    switch (x) {
        case X.FOO:
            return x;
        case X.BAR:
            return x;
    }
}

// compiles
function test2(x: X) {
    switch (x) {
        case X.FOO:
            return x;
        case X.BAR:
            return x;
    }
}

// compiles
function test3(x: "foo" | "bar") {
    switch (x) {
        case "foo":
            return x;
        case "bar":
            return x;
    }
}

// compiles
function test4(x: "foo" | "bar") {
    switch (x) {
        case XConst.FOO:
            return x;
        case XConst.BAR:
            return x;
    }
}
```

### 🙁 Actual behavior

function `test` does not compile

### 🙂 Expected behavior

Function `test` compiles
Repository: deno
Issue: [Tracking Issue] Direct Sockets API
Labels: suggestion,needs discussion

Dear Deno team,

A year and a half ago @jasnell kicked off a discussion for a new unified net/tls/udp API https://github.com/nodejs/node/issues/40067 in the NodeJS repo (with some mentions of possible cross-collaboration with Deno: https://github.com/nodejs/node/issues/40067#issuecomment-918239393). However, that thread has been inactive for quite a while, and I'm interested in revisiting those findings.

One of the options for alignment https://github.com/nodejs/node/issues/40067#issuecomment-918278674 there was the [Direct Sockets API](https://github.com/WICG/direct-sockets) (ex Raw Sockets) which has significantly evolved since then. I've raised https://github.com/nodejs/node/issues/47511 to gather some feedback from NodeJS folks, and I'd appreciate if the Deno community could also share their thoughts on the matter here -- from design improvements/suggestions/feature requests to potential alignment opportunities.

The API is currently in a limited developer trial, so there's plenty of room for incorporating new feedback and altering the API shape.

[Explainer](https://github.com/WICG/direct-sockets/blob/main/docs/explainer.md)
[Spec](https://wicg.github.io/direct-sockets/)
[Example](https://github.com/GoogleChromeLabs/telnet-client): Telnet Client over Direct Sockets

I'd like to stress that there's no intent to introduce any breaking changes nor alter the existing APIs; I believe that the Direct Sockets API could serve as a nice addition to the current stack and bridge the gap between Deno and the Web Platform.

I would be happy to discuss further if you are interested!
Repository: neovim
Issue: LSP: textDocument/semanticTokens/range
Labels: enhancement,lsp,highlight

### Problem

By far, `textDocument/semanticTokens/full` and `textDocument/semanticTokens/full/delta` are already supported. The problem is, most servers don't have support for `textDocument/semanticTokens/full/delta` and nvim will try to request and process full semantic tokens response at every buffer change. Even though the request is debounced, there will be noticeable lagging experience if the token response is quite large due to the large file.


### Expected behavior

Disabling it for large file could be a workaround; but I think supporting `textDocument/semanticTokens/range` is another solution. We can only request semantic tokens for visible screen (possibly with buffer).
Repository: stable-diffusion-webui
Issue: [Feature Request]: Batch txt2img from folder of images metadata/settings
Labels: enhancement

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What would your feature do ?

The goal is to run a batch txt2img but using full prompts and settings from a folder of images that have webui metadata in them.

Essentially to run all the same settings from images as before but maybe on a new model, this is different to running an xy plot as sometimes we may want to run batch images on collected metadata or "favourite" metadata that we have from a folder of images we saved or outputted previously.

### Proposed workflow

1. Go to "txt2img" tab
2. New section "Batch Metadata from Directory"
3. Select an input folder of images that all contain metadata for webui settings
4. Have configurable overrides such as:

- Override seed
- Override CFG
- Override resolution etc
5. Run batch txt2img

The script/extension should take the metadata from an image in the folder, copy all the settings into the txt2img run, any settings that the user overrides such as seed will not be taken from the metadata but the UI instead, the job should run across all images in the folder.



### Additional information

_No response_
Repository: go
Issue: crypto/x509: ParseCertificate should mention the ownership of the slice passed to it.
Labels: Documentation,NeedsInvestigation

ParseCertificate and ParseCertificates should mention that the argument (der) is the same as the cert.Raw. 
https://github.com/golang/go/blob/267b50a8349790afaff6649b719331fc89ef8825/src/crypto/x509/parser.go#L800-L810

From the docs is doesn't seem to be the case.
https://github.com/golang/go/blob/267b50a8349790afaff6649b719331fc89ef8825/src/crypto/x509/parser.go#L983-L985

All of these fields should mention that they share the memory with the slice passed to ParseCertificate.
https://github.com/golang/go/blob/267b50a8349790afaff6649b719331fc89ef8825/src/crypto/x509/x509.go#L677-L684
Repository: godot
Issue: 3.x: Importing from glTF ignores unicode escapes
Labels: bug,topic:import

### Godot version

3.2.x until 3.5.2

### System information

Windows 10

### Issue description

Since 3.2.x releases, there is an issue on importing glTF files with meshes named using unicode escapes.
The unicode escapes are completely ignored.

Example: a node named "Alças" can be found like below in a glTF (text) file:
```
"nodes" : [
        {
            "mesh" : 0,
            "name" : "Al\u00e7as"
        },
]
```
But, after importing on Godot, it appears like: "Alas", ignoring the character "ç" (`\u00e7`).

### Steps to reproduce

1. Open the project here provided
2. On FileSystem panel, click twice  on "gltf-unicode-character-test.gltf" to "Open anyway"
3. Look at the mesh name: "Alas" instead of "Alças".

### Minimal reproduction project

[unicode-character-test.zip](https://github.com/godotengine/godot/files/11202842/unicode-character-test.zip)
Repository: flutter
Issue: Wrapping a Scrollbar around a TabBar throws error `The Scrollbar's ScrollController has no ScrollPosition attached.`
Labels: framework,f: material design,f: scrolling,a: error message,has reproducible steps,P2,found in release: 3.10,found in release: 3.11,team-design,triaged-design

Wrapping a Scrollbar around a TabBar **works** but throws a console error 

**The Scrollbar's ScrollController has no ScrollPosition attached.**
A Scrollbar cannot be painted without a ScrollPosition. 

The Scrollbar attempted to use the PrimaryScrollController. This ScrollController should be associated with the ScrollView that the Scrollbar is being applied to.A ScrollView with an Axis.vertical ScrollDirection on mobile platforms will automatically use the PrimaryScrollController if the user has not provided a ScrollController. To use the PrimaryScrollController explicitly, set ScrollView.primary to true for the Scrollable widget.

The fix described in this commend https://github.com/flutter/flutter/issues/97873#issuecomment-1086520352 does not work because a tabcontroller cannot be applied to a scrollcontroller

```
PreferredSize(
              preferredSize: const Size.fromHeight(55),
              child: RawScrollbar(
                //controller: PrimaryScrollController.of(context),
                //padding: EdgeInsets.all(5),
                mainAxisMargin: 5,
                trackVisibility: false,
                thumbColor: Theme.of(context).focusColor,
                thickness: 3,
                thumbVisibility: true,
                interactive: false,
                scrollbarOrientation: ScrollbarOrientation.top,
                child: TabBar(
                  padding: const EdgeInsets.only(top: 5),
                  controller: _tabController,
                  labelPadding: const EdgeInsets.symmetric(horizontal: 20),
                  //padding: const EdgeInsets.only(top: 5,bottom: 5, left: 5, right: 5),
                  labelColor: Theme.of(context).colorScheme.primary,
                  labelStyle: Theme.of(context).textTheme.titleMedium,
                  isScrollable: true,
                  unselectedLabelColor:
                      Theme.of(context).focusColor.withOpacity(0.7),
                  indicatorColor: Theme.of(context).colorScheme.primary,
                  tabs: __tabs,
                ),
              ),
            ),
```

Working with **Channel stable, 3.7.10** and the issue appears on all platforms
Repository: go
Issue: proposal: go install: allow whitespace delimited package names from separate modules and versions
Labels: Proposal,GoCommand

<!--
Our proposal process is documented here:
https://go.dev/s/proposal-process
-->

I would like to be able to run:

```sh
go install \
	github.com/alexkohler/nakedret@v1.0.1 \
	github.com/kisielk/errcheck@v1.6.3 \
	github.com/magefile/mage@v1.14.0 \
	github.com/mcandre/factorio/cmd/factorio@v0.0.3 \
	golang.org/x/lint/golint@latest \
	golang.org/x/tools/cmd/goimports@latest \
	golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest \
	honnef.co/go/tools/cmd/staticcheck@2023.1.3

go mod tidy
```

Like I can with other common package managers (apt, yum, brew, cargo).

However, Go currently has this policy prohibiting this invocation. So I have to instead write down the same package commands in a longer boilerplate:

```sh
go install github.com/alexkohler/nakedret@v1.0.1
go install github.com/kisielk/errcheck@v1.6.3
go install github.com/magefile/mage@v1.14.0
go install github.com/mcandre/factorio/cmd/factorio@v0.0.3
go install golang.org/x/lint/golint@latest
go install golang.org/x/tools/cmd/goimports@latest
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
go install honnef.co/go/tools/cmd/staticcheck@2023.1.3

go mod tidy
```

Can we please remove the current restriction against asking `go install` to request separate modules and versions per run?

No, I don't want to use an alias or other shim. That introduces fragility and vendor locks provisioning scripts.

When `go mod` eventually standardizes built-in support for pinning dev dependencies, then that would somewhat mitigate the need for this feature in `go install`. But this feature would still serve as a good complement to `go mod`, regardless.
Repository: pytorch
Issue: Sharded Grad Scaler Issue Tracker
Labels: oncall: distributed,triaged,module: amp (automated mixed precision),module: fsdp

I recently unintentionally discovered that there exists a [sharded_grad_scaler.py](https://github.com/pytorch/pytorch/blob/4584851da5cad7f2e5f9fd5ed2245f3a06f8359e/torch/distributed/fsdp/sharded_grad_scaler.py#L4) which derives a lot from our [amp/grad_scaler.py](https://github.com/pytorch/pytorch/blob/e64ddd1ab9d46cfc921c19269969ffc5cd7d6f6c/torch/cuda/amp/grad_scaler.py#L195).

- [ ] A lot of the duplication seems unnecessary. ShardedGradScaler should reuse/call as much of GradScaler as possible instead copying/pasting. This way, ShardedGradScaler can be automatically enrolled in GradScaler bug fixes/improvements.
- [ ] It is uncertain whether ShardedGradScaler supports all that current GradScaler supports in a consistent way, such as being able to call unscale separate from step like in the grad clipping use case: https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.GradScaler.unscale_
- [ ] ShardedGradScaler should be documented as a public API once it's ready. It would be good to link to it from the existing GradScaler page.

cc @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @H-Huang @kwen2501 @awgu @mcarilli @ptrblck @leslie-fang-intel @jgong5
Repository: go
Issue: x/tools/gopls: rename applies duplicate edits to a file with aliases (symlinks)
Labels: NeedsFix,gopls,Tools,Refactoring

The kubernetes repo has multiple submodules (`k8s.io/xyz`), each with a replace directive in the main module that maps them to `./staging/xyz`. The `vendor` directory contains symbolic links `vendor/xyz` to `../staging/xyz`. This means files and directories in staging have aliases such `vendor/k8s.io/kubectl -> ../../staging/src/k8s.io/kubectl`.

I have observed that some gopls renamings cause the same edits to be applied to both aliases of the same file. If the renaming is length-preserving, this is harmless, but otherwise a renaming from A to AB results in ABB, with a repeated suffix. (Presuambly a renaming that shortened would be even more destructive.)

We need to merge edits not just based on URI equivalence (as we do already), but based on the file system's notion of equivalence, using os.SameFile or [robustio.FileID](https://pkg.go.dev/golang.org/x/tools/internal/robustio#FileID).

(See also https://go.dev/cl/457615, which did the same thing for the go/analysis -fix logic.)
Repository: pytorch
Issue: Support SPDA on non-CUDA backends
Labels: triaged,module: sdpa

### 🚀 The feature, motivation and pitch

Currently, [SPDA](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html#torch.nn.functional.scaled_dot_product_attention) supports  CUDA backend as outlined in the documentation tutorial. Requesting the op to become available for other backends, specifically, `torch_xla`. 

CC @JackCaoG @wconstab 


cc @jbschlosser @bhosmer @cpuhrsch @erichan1
Repository: flutter
Issue: libapp.so differs when built with local-engine vs. artifacts
Labels: platform-android,engine,P3,platform-host-arm,team-android,triaged-android

I'm not sure if this matters, but it surprised me (and broke my local testing flow for Shorebird).

When I build an app (just the stock counter app is fine) with normal `flutter appbundle --release` the resulting libapp.so is different than if I use `flutter appbundle --release --local-engine-src-path /path/to/engine/src --local-engine android_release_arm64`.  Is that expected?  As far as I can tell I've synced down the exact revision and built just like the stock artifacts.

I'm on an M2 MacBook Pro, which might be causing these differences?  I suspect the release artifacts are built from an x86 machine.

For example, Flutter 3.7.10:
```
gclient sync -r flutter@ec975089acb540fc60752606a3d3ba809dd1528b
./flutter/tools/gn --no-goma --android --android-cpu=arm64 --runtime-mode=release
./flutter/tools/gn --no-goma --runtime-mode=release
ninja -C out/android_release_arm64
ninja -C out/host_release
```

```
flutter appbundle --release --local-engine-src-path /path/to/engine/src --local-engine android_release_arm64
cp build/app/intermediates/stripped_native_libs/release/out/lib/arm64-v8a/libapp.so local-engine.so

flutter appbundle --release
cp build/app/intermediates/stripped_native_libs/release/out/lib/arm64-v8a/libapp.so stock-flutter.so
```

```
% diff stock-flutter.so local-engine.so 
Binary files stock-flutter.so and local-engine.so differ
```

Maybe I'm not faithfully replicating the artifacts?  Maybe it's not possible to build the release artifacts from an ARM Mac?
```
% uname -a
Darwin Erics-MacBook-Pro.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:46 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6020 arm64

% xcodebuild -version 
Xcode 14.2
Build version 14C18
```
Repository: next.js
Issue: API resolved without sending a response - Next.js
Labels: bug

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Terminal: API resolved without sending a response for /api/post, this may result in stalled requests.
error - unhandledRejection: ClientError: Mutation(s) failed with 1 error(s)

Fold Structure --> pages/api/post/index.ts
```


### Which area(s) of Next.js are affected? (leave empty if unsure)

_No response_

### Link to the code that reproduces this issue

npx-x-p

### To Reproduce

import type { NextApiRequest, NextApiResponse } from 'next';

import { allPostsQuery } from '../../../utils/queries';
import { client } from '../../../utils/client';

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
    if (req.method === 'GET') {
        const query = allPostsQuery();

        const data = await client.fetch(query);

        res.status(200).json(data);
    } else if (req.method === 'POST') {
        const doc = req.body;

        client.create(doc).then(() => {
            res.status(200).json('video created');
          
        });
    }
}


### Describe the Bug

I am trying to upload video post in my sanity backend content using axios. The problem is with the POST request. It says unhandledRejection: ClientError: Mutation(s) failed with 1 error(s). The method to handle uploading the post:


const handlePost = async () => {
        if (caption && videoAsset?._id && topic) {
            setSavingPost(true);

            const doc = {
                _type: 'post',
                caption,
                video: {
                    _type: 'file',
                    asset: {
                        _type: 'reference',
                        _ref: videoAsset?._id,
                    },
                },
                userId: userProfile?._id,
                postedBy: {
                    _type: 'postedBy',
                    _ref: userProfile?._id,
                },
                topic,
            };

            await axios.post('http://localhost:3000/api/post', doc);

            router.push("/")
        }
    };


### Expected Behavior

Getting a response from POST request and Saving videos in my sanity backend.

### Which browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_
Repository: pytorch
Issue: Document the user-facing API for the component-level logging system
Labels: module: docs,triaged

Document the component-level logging system that was added for #94788

cc @svekars @carljparker
Repository: pytorch
Issue: Expand component configurable logging system to C++
Labels: module: logging,triaged

The component configurable logging system introduced for #94788 needs to be expanded to control logs generated from C++

Some of the requirements for this are discussed here:
* https://github.com/pytorch/pytorch/issues/94788#issuecomment-1502519872
* https://github.com/pytorch/pytorch/issues/94788#issuecomment-1503989249

List of requirements:

  * Logs generated in C++ should get piped out to the Python logging system.

  * C++ should have access to all the logging component and artifact types
    available in Python.

  * From Python user's perspective, whether a log came from C++ or Python
    should be opaque.
Repository: flutter
Issue: Update dashboard frontend to group dart-internal build results together and add a separator from the cocoon builds
Labels: team-infra,P2,triaged-infra

We need to be able to clearly tell from the dashboard that dart-internal builds are different from cocoon builds, something like adding some padding after all cocoon builds, and then displaying all dart-internal builds at the end.
Repository: flutter
Issue: [Impeller] GL backend has a race around surface setup and toImage/toImageSync
Labels: engine,P2,e: impeller,team-engine,triaged-engine

See https://github.com/flutter/flutter/issues/124181

This code:

```dart
import 'dart:ui';

void main() async {
  final recorder = PictureRecorder();
  final canvas = Canvas(recorder);

  canvas.drawCircle(Offset.zero, 10, Paint());

  final picture = recorder.endRecording();

  final image = picture.toImageSync(20, 20); // Image was null
  final byteData = await image.toByteData(
    format: ImageByteFormat.png,
  );
  print(byteData!.buffer.asUint32List());
}
```

May fail even after https://github.com/flutter/engine/pull/41059, because we need to make sure the GL context is current before doing the rendering.

This isn't a problem on Metal or Vulkan, where there's no current context to worry about, so I'd like to land the fix for Metal independently of GLES - especially since that patch is already pretty large and will be looking to cherry pick it.
Repository: tensorflow
Issue: [MLIR-HLO] Missing legalization for mhlo.scatter to standard MLIR
Labels: stat:awaiting tensorflower,type:support,comp:xla

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Support

### Have you reproduced the bug with TF nightly?

No

### Source

source

### Tensorflow Version

main branch

### Custom Code

Yes

### OS Platform and Distribution

_No response_

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

See below.

### Standalone code to reproduce the issue

```shell
mhlo.scatter
```


### Relevant log output

_No response_</details>

### Problem Statement

Is there a pass (sequence) that can lower the `mhlo.scatter` operation to standard MLIR dialects, such as linalg, tensor, arith, and/or scf?

The goal is to ultimately lower to the LLVM dialect and perform codegen with LLVM. I wasn't able to find a pass that converts the `mhlo.scatter` op out of the MLIR-HLO dialect domain. Most other ops can be converter via passes like `--hlo-legalize-to-linalg`, `--mhlo-legalize-to-std`, or `--mhlo-legalize-control-flow`. 

(Duplicate of https://github.com/tensorflow/mlir-hlo/issues/64 since I'm not sure that repository is monitored for issues.)