`$this.Square(3)` inside a class method is a call to a sibling method and must link the two. The invocation parses as an `invokation_expression`, but only the bare-command form was walked, so every method call was dropped from the call graph (#3992).
(tmp_path)
| 3075 | |
| 3076 | |
| 3077 | def test_powershell_this_method_call_resolves(tmp_path): |
| 3078 | """`$this.Square(3)` inside a class method is a call to a sibling method and |
| 3079 | must link the two. The invocation parses as an `invokation_expression`, but |
| 3080 | only the bare-command form was walked, so every method call was dropped from |
| 3081 | the call graph (#3992).""" |
| 3082 | f = tmp_path / "calc.ps1" |
| 3083 | f.write_text( |
| 3084 | "class Calc {\n" |
| 3085 | " [int] Square([int]$x) { return $x * $x }\n" |
| 3086 | " [int] Run() { return $this.Square(3) }\n" |
| 3087 | "}\n" |
| 3088 | ) |
| 3089 | r = extract_powershell(f) |
| 3090 | assert "error" not in r |
| 3091 | assert ("Run", "Square") in _edge_labels(r, "calls") |
| 3092 | |
| 3093 | |
| 3094 | def test_powershell_static_method_call_resolves(tmp_path): |
nothing calls this directly
no test coverage detected