Skip to content

Commit 2a819fb

Browse files
committed
Merge branch 'main' into dcreager/promote-literals
* main: [ty] Infer function call typevars in both directions (#18155) Add rustfmt.toml file (#18197) [ty] Update mypy primer (#18196) [ty] Mark generated files as such in .gitattributes (#18195) [ty] Support `typing.TypeAliasType` (#18156)
2 parents ae829ef + 97058e8 commit 2a819fb

File tree

22 files changed

+737
-126
lines changed

22 files changed

+737
-126
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ crates/ruff_linter/resources/test/fixtures/pyupgrade/UP018_LF.py text eol=lf
2121
crates/ruff_python_parser/resources/inline linguist-generated=true
2222

2323
ruff.schema.json -diff linguist-generated=true text=auto eol=lf
24+
ty.schema.json -diff linguist-generated=true text=auto eol=lf
2425
crates/ruff_python_ast/src/generated.rs -diff linguist-generated=true text=auto eol=lf
2526
crates/ruff_python_formatter/src/generated.rs -diff linguist-generated=true text=auto eol=lf
2627
*.md.snap linguist-language=Markdown

.github/workflows/mypy_primer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
echo "Project selector: $PRIMER_SELECTOR"
7070
# Allow the exit code to be 0 or 1, only fail for actual mypy_primer crashes/bugs
7171
uvx \
72-
--from="git+https://github.com/hauntsaninja/mypy_primer@968b2b61c05f84462d6fcc78d2f5205bbb8b98c2" \
72+
--from="git+https://github.com/hauntsaninja/mypy_primer@01a7ca325f674433c58e02416a867178d1571128" \
7373
mypy_primer \
7474
--repo ruff \
7575
--type-checker ty \

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ members = ["crates/*"]
33
resolver = "2"
44

55
[workspace.package]
6+
# Please update rustfmt.toml when bumping the Rust edition
67
edition = "2024"
78
rust-version = "1.85"
89
homepage = "https://docs.astral.sh/ruff"

crates/ruff_text_size/Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
name = "ruff_text_size"
33
version = "0.0.0"
44
publish = false
5-
edition = "2021"
6-
rust-version = "1.67.1"
5+
authors = { workspace = true }
6+
edition = { workspace = true }
7+
rust-version = { workspace = true }
8+
homepage = { workspace = true }
9+
documentation = { workspace = true }
10+
repository = { workspace = true }
11+
license = { workspace = true }
712

813
[dependencies]
914
serde = { workspace = true, optional = true }

crates/ruff_text_size/src/schemars_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//! bindings to the Workspace API
77
88
use crate::{TextRange, TextSize};
9-
use schemars::{r#gen::SchemaGenerator, schema::Schema, JsonSchema};
9+
use schemars::{JsonSchema, r#gen::SchemaGenerator, schema::Schema};
1010

1111
impl JsonSchema for TextSize {
1212
fn schema_name() -> String {

crates/ruff_text_size/src/serde_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use {
22
crate::{TextRange, TextSize},
3-
serde::{de, Deserialize, Deserializer, Serialize, Serializer},
3+
serde::{Deserialize, Deserializer, Serialize, Serializer, de},
44
};
55

66
impl Serialize for TextSize {

crates/ruff_text_size/tests/serde.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use {
22
ruff_text_size::{TextRange, TextSize},
3-
serde_test::{assert_de_tokens_error, assert_tokens, Token},
3+
serde_test::{Token, assert_de_tokens_error, assert_tokens},
44
std::ops,
55
};
66

crates/ty/docs/.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
rules.md -diff linguist-generated=true text=auto eol=lf
2+
cli.md -diff linguist-generated=true text=auto eol=lf
3+
configuration.md -diff linguist-generated=true text=auto eol=lf

crates/ty/docs/rules.md

Lines changed: 78 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ty_ide/src/goto.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,40 @@ mod tests {
522522
assert_snapshot!(test.goto_type_definition(), @"No type definitions found");
523523
}
524524

525+
#[test]
526+
fn goto_type_of_bare_type_alias_type() {
527+
let test = cursor_test(
528+
r#"
529+
from typing_extensions import TypeAliasType
530+
531+
Alias = TypeAliasType("Alias", tuple[int, int])
532+
533+
Alias<CURSOR>
534+
"#,
535+
);
536+
537+
assert_snapshot!(test.goto_type_definition(), @r#"
538+
info[goto-type-definition]: Type definition
539+
--> main.py:4:13
540+
|
541+
2 | from typing_extensions import TypeAliasType
542+
3 |
543+
4 | Alias = TypeAliasType("Alias", tuple[int, int])
544+
| ^^^^^
545+
5 |
546+
6 | Alias
547+
|
548+
info: Source
549+
--> main.py:6:13
550+
|
551+
4 | Alias = TypeAliasType("Alias", tuple[int, int])
552+
5 |
553+
6 | Alias
554+
| ^^^^^
555+
|
556+
"#);
557+
}
558+
525559
#[test]
526560
fn goto_type_on_keyword_argument() {
527561
let test = cursor_test(

0 commit comments

Comments
 (0)