Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 6 additions & 28 deletions integrationtests/fixtures/snapshots/go/diagnostics/dependency.snap
Original file line number Diff line number Diff line change
@@ -1,34 +1,12 @@
===
---

/TEST_OUTPUT/workspace/consumer.go
Location: Line 7, Column 28
Message: not enough arguments in call to HelperFunction
Diagnostics in File: 1
ERROR at L7:C28: not enough arguments in call to HelperFunction
have ()
want (int)
Source: compiler
Code: WrongArgCount
===
want (int) (Source: compiler, Code: WrongArgCount)

6|func ConsumerFunction() {
7| message := HelperFunction()
8| fmt.Println(message)
9|
10| // Use shared struct
11| s := &SharedStruct{
12| ID: 1,
13| Name: "test",
14| Value: 42.0,
15| Constants: []string{SharedConstant},
16| }
17|
18| // Call methods on the struct
19| fmt.Println(s.Method())
20| s.Process()
21|
22| // Use shared interface
23| var iface SharedInterface = s
24| fmt.Println(iface.GetName())
25|
26| // Use shared type
27| var t SharedType = 100
28| fmt.Println(t)
29|}

Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
===
/TEST_OUTPUT/workspace/main.go
Location: Line 8, Column 2
Message: unreachable code
Source: unreachable
Code: default
===
6|func FooBar() string {
7| return "Hello, World!"
8| fmt.Println("Unreachable code") // This is unreachable code
9|}
---

===
/TEST_OUTPUT/workspace/main.go
Location: Line 9, Column 1
Message: missing return
Source: compiler
Code: MissingReturn
===
Diagnostics in File: 2
WARNING at L8:C2: unreachable code (Source: unreachable, Code: default)
ERROR at L9:C1: missing return (Source: compiler, Code: MissingReturn)

6|func FooBar() string {
7| return "Hello, World!"
8| fmt.Println("Unreachable code") // This is unreachable code
9|}

Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
===
---

/TEST_OUTPUT/workspace/consumer_clean.py
Location: Line 9, Column 15
Message: Argument missing for parameter "age"
Source: Pyright
Code: reportCallIssue
===
Diagnostics in File: 1
ERROR at L9:C15: Argument missing for parameter "age" (Source: Pyright, Code: reportCallIssue)

6|def consumer_function() -> None:
7| """Function that consumes the helper functions."""
8| # Use the helper function
9| message = helper_function("World")
10| print(message)
11|
12| # Get and process items from the helper
13| items = get_items()
14| for item in items:
15| print(f"Processing {item}")

54 changes: 17 additions & 37 deletions integrationtests/fixtures/snapshots/python/diagnostics/errors.snap
Original file line number Diff line number Diff line change
@@ -1,46 +1,26 @@
===
---

/TEST_OUTPUT/workspace/error_file.py
Location: Line 31, Column 12
Message: Type "Literal[42]" is not assignable to return type "str"
  "Literal[42]" is not assignable to "str"
Source: Pyright
Code: reportReturnType
===
Diagnostics in File: 3
ERROR at L31:C12: Type "Literal[42]" is not assignable to return type "str"
  "Literal[42]" is not assignable to "str" (Source: Pyright, Code: reportReturnType)
ERROR at L47:C15: "undefined_variable" is not defined (Source: Pyright, Code: reportUndefinedVariable)
ERROR at L51:C19: Type "Literal[123]" is not assignable to declared type "str"
  "Literal[123]" is not assignable to "str" (Source: Pyright, Code: reportAssignmentType)

25|def function_with_type_error() -> str:
26| """A function with a type error.
27|
28| Returns:
...
29| Should return a string but actually returns an int
30| """
31| return 42 # Type error: Incompatible return value type (got "int", expected "str")

===
/TEST_OUTPUT/workspace/error_file.py
Location: Line 47, Column 15
Message: "undefined_variable" is not defined
Source: Pyright
Code: reportUndefinedVariable
===
...
34|class ErrorClass:
35| """A class with errors."""
36|
37| def __init__(self, value: dict[str, Any]):
38| """Initialize with errors.
39|
40| Args:
41| value: A dictionary
42| """
43| self.value = value
44|
...
45| def method_with_undefined_variable(self) -> None:
46| """A method that uses an undefined variable."""
47| print(undefined_variable) # Error: undefined_variable is not defined

===
/TEST_OUTPUT/workspace/error_file.py
Location: Line 51, Column 19
Message: Type "Literal[123]" is not assignable to declared type "str"
  "Literal[123]" is not assignable to "str"
Source: Pyright
Code: reportAssignmentType
===
...
49|
50|# Variable with incompatible type annotation
51|wrong_type: str = 123 # Type error: Incompatible types in assignment
52|
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
===
---

/TEST_OUTPUT/workspace/another_consumer.py
References in File: 1
===
Reference at Line 40, Column 19:
At: L40:C19

31|def another_consumer_function() -> None:
32| """Another function that uses various shared components."""
33| # Use shared constants
34| print(f"Using constant: {SHARED_CONSTANT}")
...
35|
36| # Use shared class with a different type parameter
37| shared = SharedClass[float]("another example", 3.14)
Expand All @@ -18,30 +17,15 @@ Reference at Line 40, Column 19:
43|
44| # Use our own implementation
45| impl = AnotherImplementation()
46| result = impl.do_something()
47| print(f"Implementation result: {result}")
48|
49| # Use helper function
50| output = helper_function("another direct call")
51| print(f"Helper output: {output}")
52|
53| # Use enum-like class with a different color
54| color = Color.GREEN
55| print(f"Selected color: {color}")

===
---

/TEST_OUTPUT/workspace/consumer.py
References in File: 1
===
Reference at Line 47, Column 41:
At: L47:C41

34|def consumer_function() -> None:
35| """Function that consumes the helper functions."""
36| # Use the helper function
37| message = helper_function("World")
38| print(message)
39|
40| # Get and process items from the helper
41| items = get_items()
...
42| for item in items:
43| print(f"Processing {item}")
44|
Expand All @@ -53,8 +37,3 @@ Reference at Line 47, Column 41:
50| impl = MyImplementation()
51| result = impl.process(items)
52| print(f"Processed items: {result}")
53|
54| # Use the enum
55| color = Color.RED
56| print(f"Selected color: {color}")

Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
===
---

/TEST_OUTPUT/workspace/another_consumer.py
References in File: 2
===
Reference at Line 54, Column 13:
At: L7:C5, L54:C13

2|
3|from helper import (
4| SHARED_CONSTANT,
5| SharedClass,
6| helper_function,
7| Color,
8|)
9|
10|
11|class AnotherImplementation:
12| """A class that uses shared components but doesn't implement interfaces."""
...
31|def another_consumer_function() -> None:
32| """Another function that uses various shared components."""
33| # Use shared constants
34| print(f"Using constant: {SHARED_CONSTANT}")
35|
36| # Use shared class with a different type parameter
37| shared = SharedClass[float]("another example", 3.14)
38|
39| # Use methods from shared class
40| name = shared.get_name()
41| value = shared.get_value()
42| print(f"Name: {name}, Value: {value}")
43|
44| # Use our own implementation
45| impl = AnotherImplementation()
46| result = impl.do_something()
47| print(f"Implementation result: {result}")
48|
...
49| # Use helper function
50| output = helper_function("another direct call")
51| print(f"Helper output: {output}")
Expand All @@ -29,32 +26,30 @@ Reference at Line 54, Column 13:
54| color = Color.GREEN
55| print(f"Selected color: {color}")

===
---

/TEST_OUTPUT/workspace/consumer.py
References in File: 2
===
Reference at Line 55, Column 13:
At: L9:C5, L55:C13

4| helper_function,
5| get_items,
6| SharedClass,
7| SharedInterface,
8| SHARED_CONSTANT,
9| Color,
10|)
11|
12|
13|class MyImplementation(SharedInterface):
14| """An implementation of the SharedInterface."""
...
34|def consumer_function() -> None:
35| """Function that consumes the helper functions."""
36| # Use the helper function
37| message = helper_function("World")
38| print(message)
39|
40| # Get and process items from the helper
41| items = get_items()
42| for item in items:
43| print(f"Processing {item}")
44|
45| # Use the shared class
46| shared = SharedClass[str]("consumer", SHARED_CONSTANT)
47| print(f"Using shared class: {shared.get_name()} - {shared.get_value()}")
48|
49| # Use our implementation of the shared interface
...
50| impl = MyImplementation()
51| result = impl.process(items)
52| print(f"Processed items: {result}")
53|
54| # Use the enum
55| color = Color.RED
56| print(f"Selected color: {color}")

Loading
Loading