Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Migrate typed tree to use AST with locs for fn arguments#7873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
zth merged 3 commits intomasterfromarg-types
Oct 6, 2025

Conversation

@zth
Copy link
Member

@zthzth commentedSep 11, 2025
edited
Loading

This migrates fn arguments to use the AST nodes with locations in the typed tree as well. It was previously just used for the parsetree.

Lays the foundations for some other refactors as well.

nojaf, fhammerschmidt, mediremi, and cknitt reacted with heart emoji
innerFunctionDefinition.kind
|>List.map (fun (entry: Kind.entry) ->
(Asttypes.Noloc.Labelled entry.label,
(Asttypes.Labelled{txt=entry.label; loc=Location.none},
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've assumed that tracking the loc is unimportant here since reanalyze worked well before this refactor, and didn't have locs then.

Comment on lines -176 to +178
if labelDecl.ld_optionalthenAsttypes.Noloc.Optional lblName
elseLabelled lblName
if labelDecl.ld_optionalthen
Asttypes.Optional {txt= lblName; loc=Location.none}
elseAsttypes.Labelled {txt= lblName; loc=Location.none}
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Same here, I've assumed tracking the loc is not important here. We could however trivially addlabelDecl.ld_loc here if we wanted to.

@pkg-pr-new
Copy link

pkg-pr-newbot commentedSep 11, 2025
edited
Loading

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7873

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7873

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7873

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7873

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7873

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@7873

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7873

commit:9649c71

@zthzth marked this pull request as ready for reviewSeptember 11, 2025 09:12
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR migrates the function argument handling in the typed tree representation from using location-stripped argument labels (Noloc.arg_label) to using AST nodes with locations (arg_label). This change aligns the typed tree with the parse tree representation and lays groundwork for future refactors.

Key changes:

  • ReplaceNoloc.arg_label witharg_label throughout the typed tree
  • Update pattern matching from string-based to record-based field access
  • Remove theto_noloc conversion function calls

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 7 comments.

Show a summary per file
FileDescription
compiler/ml/typetexp.mlRemove conversion to noloc for function argument labels
compiler/ml/types.mliUpdate type definition to use located arg_label
compiler/ml/types.mlUpdate type definition to use located arg_label
compiler/ml/typedtree.mliUpdate function and argument type definitions
compiler/ml/typedtree.mlUpdate function and argument type definitions
compiler/ml/typecore.mliUpdate error type definitions
compiler/ml/typecore.mlUpdate error handling and pattern matching
compiler/ml/printtyped.mlUpdate argument label printing
compiler/ml/printtyp.mliUpdate function signature
compiler/ml/printtyp.mlUpdate label string conversion
compiler/ml/ctype.mliUpdate filter_arrow signature
compiler/ml/ctype.mlUpdate type comparison functions
compiler/ml/btype.mliConsolidate utility functions
compiler/ml/btype.mlRemove duplicate utility functions
compiler/ml/asttypes.mlRemove Noloc-specific comparison function
compiler/gentype/*.mlUpdate gentype translation functions
analysis/src/*.mlUpdate analysis functions for new label format

Tip: Customize your code reviews with copilot-instructions.md.Create the file orlearn how to get started.

@nojaf
Copy link
Member

I guessmodule Noloc is only used inparsetree0.ml.
Perhaps add a note there, that is only exists for legacy reasons.

Copy link
Collaborator

@cristianoccristianoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pretty clean throughout

@zthzthenabled auto-merge (squash)October 6, 2025 12:23
@zthzth merged commit6a9ffc1 intomasterOct 6, 2025
24 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@cristianoccristianoccristianoc approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@zth@nojaf@cristianoc

[8]ページ先頭

©2009-2025 Movatter.jp