Commit b74a9e1
Split TypedTreeOps.fs (12,569 lines) into 7 focused files (#19521)
* Create TypedTreeOps.Remap.fs and .fsi (Sprint 1 of 7)
Extract lines 1-1230 from TypedTreeOps.fs into a new file pair
using namespace FSharp.Compiler.TypedTreeOps with three AutoOpen modules:
- TypeRemapping: TyparMap, TyconRefMap, ValMap, Remap types and the
remapTypeAux/remapValRef let-rec chain plus instantiation wrappers
- TypeConstruction: type construction/destruction/query functions,
Erasure DU, strip/dest/is functions
- TypeEquivalence: TypeEquivEnv, the traitsAEquivAux/typeEquivAux
let-rec chain, equivalence wrappers, getErasedTypes
Files are not yet added to the fsproj - that happens in a later sprint.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Extract TypedTreeOps.ExprConstruction.fs/.fsi (File 2 of 7)
Extract expression construction primitives, collection types, and
arity/metadata analysis from TypedTreeOps.fs lines ~1231-2260 into
TypedTreeOps.ExprConstruction.fs with matching .fsi file.
Organized into 3 [<AutoOpen>] modules:
- ExprConstruction: orderings, type builders, expr constructors,
MatchBuilder, lambda/let/bind builders
- CollectionTypes: ValHash, ValMultiMap, TyconRefMultiMap
- ArityAndMetadata: rescoping, field accessors, type testers,
TypeDefMetadata, free tyvar accumulators
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Extract TypedTreeOps.FreeVars.fs/.fsi (File 3 of 7)
Create File 3 of the TypedTreeOps split: free type variable analysis,
pretty-printing, and display environment.
Structure:
- FreeTypeVars module: FreeVarOptions, collection options, two recursive
chains (accFreeTycon..accFreeInVal, boundTyparsLeftToRight..accFreeInTypesLeftToRight),
addFreeInModuleTy, public wrappers, checkMemberVal/checkMemberValRef
- Display module: GetFSharpViewOfReturnType, TraitConstraintInfo extension,
member type functions, nested PrettyTypes and SimplifyTypes modules,
GenericParameterStyle, DisplayEnv, display text helpers, superOfTycon
Files are not yet added to the project file (will happen in final integration sprint).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Extract TypedTreeOps.Attributes.fs/.fsi (File 4 of 7)
Create File 4 of the TypedTreeOps split: IL extensions, attribute helpers,
and debug printing.
Structure:
- ILExtensions module: IL attribute detection functions (isILAttribByName,
classifyILAttrib, computeILWellKnownFlags, tryFindILAttribByFlag,
(|ILAttribDecoded|_|)) and type extensions on ILAttributesStored,
ILTypeDef, ILMethodDef, ILFieldDef, ILAttributes
- AttributeHelpers module: F# attribute discovery (resolveAttribPath,
classifyEntityAttrib, classifyValAttrib, computeEntityWellKnownFlags,
EntityHasWellKnownAttribute, etc.), type construction helpers, and
type ValRef extension members
- DebugPrinting module: nested DebugPrint module with showType, showExpr,
layout functions (exprL, bindingL, atomL, etc.), and
wrapModuleOrNamespace* helpers
The DebugPrint module is nested inside DebugPrinting to preserve the
FSharp.Compiler.TypedTreeOps.DebugPrint reference path used by callers.
All let rec ... and chains inside DebugPrint are kept intact.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix TypedTreeOps.Attributes.fsi: remove misplaced declarations
Remove 12 val declarations from .fsi that have no implementations in the
.fs file. These were from original TypedTreeOps.fs lines outside the
~3523-5462 extraction range:
- isInByrefTy, isOutByrefTy, isByrefTy, isNativePtrTy (original ~L1907-1923)
- EvalLiteralExprOrAttribArg, EvaledAttribExprEquality (original ~L10943-10969)
- IsSimpleSyntacticConstantExpr, ConstToILFieldInit (original ~L10646-10951)
- Int32Expr, SpecialComparableHeadType, SpecialEquatableHeadType,
SpecialNotEquatableHeadType (original ~L9986-11049)
- TyparTy|NullableTypar|... (incomplete signature causing FS0010 parse error)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Extract TypedTreeOps.Remapping.fs/.fsi (File 5 of 7)
Create the 5th split file from TypedTreeOps.fs containing:
- SignatureOps: signature repackage/hiding types and operations
- ExprFreeVars: expression-level free variable analysis (24-function chain)
- ExprRemapping: expression remapping and copying (57-function chain)
- ExprShapeQueries: type inference, remark, decision tree simplification
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Extract TypedTreeOps.ExprOps.fs/.fsi (File 6 of 7)
Create File 6 of the TypedTreeOps split: address-of operations, expression
folding, intrinsic call wrappers, and higher-level expression helpers.
Extracts original TypedTreeOps.fs lines ~7651-9599 into 4 modules:
- AddressOps: Mutates DU, address-of helpers, mkExprAddrOfExpr, field gets
- ExprFolding: IterateRecursiveFixups, ExprFolder/ExprFolders, FoldExpr
- IntrinsicCalls: 105 mkCall* wrappers, literal constructors, compilation attrs
- ExprHelpers: MakeApplicationAndBetaReduce, lambda tupling, subsumption, etc.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Extract TypedTreeOps.Transforms.fs/.fsi (File 7 of 7)
Create the final split file containing type encoding, expression rewriting,
tuple compilation, integral constants, and attribute checking.
Structure:
- TypeEncoding: typeEnc, XML doc encoding, nullness helpers, compiled-as
- Rewriting: ExprRewritingEnv, RewriteExpr, export remapping
- TupleCompilation: mkCompiledTuple, IntegralConst (nested), mkFastForLoop
- AttribChecking: CombineCcuContentFragments, Seq patterns, resumable code
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix TypedTreeOps.Transforms.fsi: remove duplicates, misplaced declarations, fix module placement
- Remove duplicate declarations: HasConstraint, IsTyparTyWithConstraint, doesActivePatternHaveFreeTypars
- Remove declarations belonging to other files (FreeVars: GetMemberTypeInMemberForm,
PartitionValTypars*, CountEnclosingTyparsOfActualParentOfVal, ReturnTypeOfPropertyVal,
ArgInfosOfPropertyVal, ArgInfosOfMember; ExprOps: mkCallDispose, mkCallSeq, mkCallTypeTest)
- Move GetTypeOfIntrinsicMemberInCompiledForm from TypeEncoding to TupleCompilation
- Move TraitWitnessInfoHashMap/EmptyTraitWitnessInfoHashMap from TupleCompilation to AttribChecking
- Move mkDebugPoint and IfThenElseExpr from AttribChecking to TupleCompilation
- Remove TraitConstraintInfo type extension (belongs to FreeVars, not this file)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Split TypedTreeOps into 7 files: wire up project, delete originals, fix cross-file deps
Replace the monolithic TypedTreeOps.fs (12,569 lines) and TypedTreeOps.fsi
(3,094 lines) with 7 focused files:
1. TypedTreeOps.Remap - Type remapping, instantiation, equivalence
2. TypedTreeOps.ExprConstruction - Expression/type construction helpers
3. TypedTreeOps.FreeVars - Free variable collection, display helpers
4. TypedTreeOps.Attributes - IL extensions, attribute classification
5. TypedTreeOps.Remapping - Signature ops, expr free vars, expr remapping
6. TypedTreeOps.ExprOps - Address ops, folding, intrinsic calls
7. TypedTreeOps.Transforms - Debug printing, pattern matching, transforms
All files use namespace FSharp.Compiler.TypedTreeOps with [<AutoOpen>]
internal modules, so the 69 callers doing 'open FSharp.Compiler.TypedTreeOps'
required zero modifications.
Integration fixes:
- Added missing opens (FSharp.Compiler, Internal.Utilities.Collections,
FSharp.Compiler.Syntax, FSharp.Compiler.CompilerGlobalState)
- Fixed .fsi signature mismatches (generic vs concrete type params)
- Exposed cross-file functions in .fsi files
- Fixed type name references (Mutability -> ValMutability, etc.)
- Applied dotnet fantomas formatting to all 14 files
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Create CommonContainers module in file 2, move container type helpers from file 4
Move container type helpers (Option, RefCell, Nullable, Choice, Byref,
LinqExpression, etc.) from AttributeHelpers in TypedTreeOps.Attributes.fs
to a new CommonContainers module in TypedTreeOps.ExprConstruction.fs.
These functions only depend on tyconRefEq, stripTyEqns, tryTcrefOfAppTy,
argsOfAppTy from file 1, not attribute infrastructure.
Create ByrefAndSpanHelpers module in file 4 for span/byref-like functions
that depend on TyconRefHasAttributeByName (must stay in file 4).
All modules use [<AutoOpen>] so callers need no changes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rename modules for coherence, move type constructors and encoding helpers
- Rename ArityAndMetadata → TypeTesters (core content is 46 is*Ty predicates)
- Rename IntrinsicCalls → Makers (174 mk* expression constructors)
- Move mkForallTy/mkForallTyIfNeeded/+-> from ExprConstruction to TypeConstruction
- Move commaEncs/angleEnc/typarEnc/ticksAndArgCountTextOfTyconRef from ExprHelpers to TypeEncoding
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Round 2: Move misplaced functions to correct modules
- Free var accumulators TypeTesters→FreeTypeVars
- Attribute helpers Makers→AttributeHelpers
- mkFunTy/mkIteratedFunTy ExprConstruction→TypeConstruction
- mk*Ty ExprShapeQueries→TypeConstruction
- mk*Type Makers→TypeConstruction
- mk*Test TypeEncoding→Makers (except mkIsInstConditional which
depends on canUseTypeTestFast in Transforms.fs, compiled after
ExprOps.fs)
- Linear* APs: kept in SignatureOps (moving to ExprShapeQueries
impossible - ExprShapeQueries is at end of Remapping.fs but
Linear* are used in ExprFreeVars and ExprRemapping modules
which appear earlier in the same file)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Round 3: Move quotation type helpers to TypeConstruction
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Round 4: Move type queries to TypeTesters, member helpers to Display
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Round 5: Move CombineCcuContentFragments to SignatureOps
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rename TupleCompilation → LoopAndConstantOptimization
The module contains tuple compilation, fast for loops, integral range
detection, constant evaluation, and loop optimization — not just tuples.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Move unblocked functions to correct modules
- underlyingTypeOfEnumTy/normalizeEnumTy ExprRemapping→TypeTesters
- ClearValReprInfo ExprRemapping→ExprHelpers
- mkArray AddressOps→Makers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Move mkLabelled from AttribChecking to Makers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Break rec chain assumptions: move standalone functions to correct modules
- isResumableCodeTy/isReturnsResumableCodeTy/isFSharpExceptionTy → TypeTesters
- serializeEntity + helpers → DebugPrint
- Linear* APs SignatureOps → ExprFreeVars (same file, earlier position)
- mkApps group ExprShapeQueries → Makers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Final placement fixes: isResumableCodeTy, mkArray, isSealedTy, export remapping
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Move updateSeqTypeIsPrefix→SignatureOps, isTyparOrderMismatch→Display
Last 2 cross-model agreed misplacements resolved.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Incorporate reviewer findings: move attribute/expr helpers to correct modules
- CompileAsEvent/ValCompileAsEvent/ModuleNameIsMangled/MemberIsCompiledAsInstance → AttributeHelpers
- valOfBind/valsOfBinds → ExprConstruction
- WhileExpr/TryWithExpr/TryFinallyExpr/IntegerForLoopExpr APs → ExprShapeQueries
- mkDebugPoint/(|InnerExprPat|)/(|Int32Expr|_|) → ExprConstruction or earlier
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Split TypeEncoding into XmlDocSignatures, NullnessAnalysis, TypeTestsAndPatterns
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Split AttribChecking into ResumableCodePatterns, SeqExprPatterns, ExtensionAndMiscHelpers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Split TypeConstruction into MeasureOps, TypeBuilders, TypeAbbreviations, TypeDecomposition
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rename Display→MemberRepresentation, dissolve ExtensionAndMiscHelpers, split LoopAndConstantOptimization
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rename TypeTesters→TypeQueries, ExprHelpers→ExprTransforms, tighten ExprShapeQueries→ExprAnalysis
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix B-grade outliers: rename CollectionTypes, move dest/is from Makers, move patterns from TupleCompilation
- Rename CollectionTypes → TypedTreeCollections
- Move destInt32/destThrow/isThrow/isIDelegateEventType/destIDelegateEventType Makers→ExprTransforms
- Move (|Int32Expr|_|)/(|IntegralRange|_|) TupleCompilation→ConstantEvaluation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Rename TypeQueries back to TypeTesters
70% of vals operate on TType, 12% on Tycon, 5% on Val — 'Testers' better
describes the is*/dest*/strip* nature than 'Queries'.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove accidentally committed scratch files
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix FS0667: disambiguate cenv record update in IlxGen.fs
The [<AutoOpen>] split brought multiple record types with 'stackGuard'
field into scope (FreeVarOptions, RemapContext, cenv). Add type annotation
to resolve ambiguity.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Apply fantomas formatting to all TypedTreeOps files
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 3319018 commit b74a9e1
19 files changed
Lines changed: 19037 additions & 15667 deletions
File tree
- src/Compiler
- CodeGen
- Driver
- TypedTree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3208 | 3208 | | |
3209 | 3209 | | |
3210 | 3210 | | |
3211 | | - | |
| 3211 | + | |
3212 | 3212 | | |
3213 | 3213 | | |
3214 | 3214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
340 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
341 | 353 | | |
342 | 354 | | |
343 | 355 | | |
| |||
Large diffs are not rendered by default.
0 commit comments