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
4 changes: 2 additions & 2 deletions scripts/profiling/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import typer


def profile(repo: str, memory: bool = False):
def profile(repo: str, memory: bool = False, extra_repos: bool = True):
type = "mem" if memory else "cpu"
base = f".profiles/{type}/{repo}"
os.makedirs(base, exist_ok=True)
output = f"{base}/raw.austin"
compressed = f"{base}/compressed.austin"
image = f"{base}/parse.svg"
test = Popen(["pytest", "tests/integration/codemod/test_parse.py", "--extra-repos=true", "--durations=100", "-k", repo])
test = Popen(["pytest", "tests/integration/codemod/test_parse.py", "--durations=100", "-k", repo, "--extra-repos=True" if extra_repos else ""])
try:
command = ["sudo", "austin", "-p", str(test.pid), "-o", output]
if memory:
Expand Down
1 change: 1 addition & 0 deletions src/codegen/sdk/codebase/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class GSFeatureFlags(BaseModel):
ignore_process_errors: bool = True # Ignore errors from dependency manager and language engine
import_resolution_overrides: dict[str, str] = {} # Override import resolution for specific modules
disable_graph: bool = False # Turn of graph generation entirely. Speeds up parsing but disables usages and dependencies
generics: bool = True # Enable parsing of generic types


DefaultFlags = GSFeatureFlags(sync_enabled=False)
Expand Down
21 changes: 11 additions & 10 deletions src/codegen/sdk/core/detached_symbols/function_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,16 +518,17 @@ def _resolved_types(self) -> Generator[ResolutionStack[Self], None, None]:
if generic := function_def_frame.generics.get(return_type.source, None):
yield from self.with_resolution_frame(generic, direct=function_def_frame.direct)
return
for arg in self.args:
if arg.parameter and (type := arg.parameter.type):
if type.source == return_type.source:
yield from self.with_resolution_frame(arg.value, direct=function_def_frame.direct)
return
if isinstance(type, GenericType):
for param in type.parameters:
if param.source == return_type.source:
yield from self.with_resolution_frame(arg.value, direct=function_def_frame.direct)
return
if self.G.config.feature_flags.generics:
for arg in self.args:
if arg.parameter and (type := arg.parameter.type):
if type.source == return_type.source:
yield from self.with_resolution_frame(arg.value, direct=function_def_frame.direct)
return
if isinstance(type, GenericType):
for param in type.parameters:
if param.source == return_type.source:
yield from self.with_resolution_frame(arg.value, direct=function_def_frame.direct)
return

yield from self.with_resolution_frame(return_type, direct=False)
elif isinstance(function_def, Class):
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/sdk/core/interfaces/chainable.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def with_resolution_frame(self, child: Editable, *args, generic_parameters: list
assert resolution is not self
generics = generics or resolution.generics
if generic_parameters:
if isinstance(resolution.top.node, SupportsGenerics):
if isinstance(resolution.top.node, SupportsGenerics) and self.G.config.feature_flags.generics:
generics = {k: v for v, k in zip(generic_parameters, resolution.top.node.generics)}
elif not generics:
generics = {i: v for i, v in enumerate(generic_parameters)}
Expand Down
Loading