Skip to content

Feature: Add folding plugin support, introduce chained function call / array access#18

Merged
VxTi merged 30 commits into
mainfrom
feature/add-enum-support
Mar 14, 2026
Merged

Feature: Add folding plugin support, introduce chained function call / array access#18
VxTi merged 30 commits into
mainfrom
feature/add-enum-support

Conversation

@VxTi
Copy link
Copy Markdown
Owner

@VxTi VxTi commented Mar 11, 2026

No description provided.

VxTi added 28 commits March 11, 2026 19:16
…ls, including dynamic wrapping based on line width settings
…s due to attempting to call function ptr as CreateCall
@VxTi VxTi changed the title Feature: Add enum support Feature: Add folding plugin support, introduce chained function call / array access Mar 13, 2026
@VxTi VxTi requested a review from Copilot March 13, 2026 19:01
Copy link
Copy Markdown
Contributor

Copilot AI 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 expands Stride language and tooling support by adding IntelliJ folding + enhanced formatting (line-width–aware wrapping), and by updating the compiler/parser/type inference to support chained postfix expressions (member access, array subscripts, and indirect calls). It also updates parts of the standard library, developer scripts, and CI to align with the new behavior.

Changes:

  • Add IntelliJ folding support and new code-style integration; introduce line-width–aware wrapping for object initializers and function calls.
  • Add compiler support for chained postfix expressions (a.b, a[i], f()(x)), plus indirect call typing/codegen.
  • Restructure parts of the standard library (new io module, new structures types) and update scripts/CI flows.

Reviewed changes

Copilot reviewed 66 out of 68 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
scripts/run_tests.sh Removed legacy compiler-only test runner.
scripts/run-tests.sh New combined compiler + IntelliJ plugin test runner with banner output.
scripts/brew-install-local.sh New local Homebrew packaging/install helper for the compiler + stdlib.
packages/stride-plugin-intellij/src/test/kotlin/com/stride/intellij/StrideStructInitFormatterTest.kt Updates expected formatting to allow single-line object init when it fits.
packages/stride-plugin-intellij/src/test/kotlin/com/stride/intellij/StrideLineWidthFormatterTest.kt Adds tests for line-width wrapping behavior and custom indent size.
packages/stride-plugin-intellij/src/test/kotlin/com/stride/intellij/StrideFormatterTest.kt Updates baseline formatter expectations for object init formatting.
packages/stride-plugin-intellij/src/main/resources/META-INF/plugin.xml Registers folding builder + code style settings providers.
packages/stride-plugin-intellij/src/main/kotlin/com/stride/intellij/highlight/StrideSyntaxHighlighter.kt Adds syntax highlighting for enum.
packages/stride-plugin-intellij/src/main/kotlin/com/stride/intellij/highlight/StrideColorSettingsPage.kt Updates demo text for highlighting preview.
packages/stride-plugin-intellij/src/main/kotlin/com/stride/intellij/editor/StrideFoldingBuilder.kt Implements folding regions and placeholders for Stride PSI nodes.
packages/stride-plugin-intellij/src/main/kotlin/com/stride/intellij/editor/StrideEnterHandlerDelegate.kt Uses configured indent size instead of hardcoded 4 spaces.
packages/stride-plugin-intellij/src/main/kotlin/com/stride/intellij/StrideLanguageCodeStyleSettingsProvider.kt Exposes indent/right-margin options for Stride.
packages/stride-plugin-intellij/src/main/kotlin/com/stride/intellij/StrideFormattingModelBuilder.kt Shifts object-init wrapping logic into StrideBlock; updates spacing rules.
packages/stride-plugin-intellij/src/main/kotlin/com/stride/intellij/StrideCodeStyleSettingsProvider.kt Adds Stride code style settings integration.
packages/stride-plugin-intellij/src/main/kotlin/com/stride/intellij/StrideCodeStyleSettings.kt Adds custom max line width setting for formatter wrapping decisions.
packages/stride-plugin-intellij/src/main/kotlin/com/stride/intellij/StrideBlock.kt Implements dynamic spacing/indent/wrapping for object init and function calls.
packages/stride-plugin-intellij/src/main/grammars/Stride.flex Adds lexer token for enum.
packages/stride-plugin-intellij/src/main/grammars/Stride.bnf Adds enum grammar + trailing commas in imports + lambda expression body expansion.
packages/stride-plugin-intellij/build.gradle.kts Ensures parser/lexer generation before Kotlin compile; expands test logging.
packages/standard-library/time.sr Renames Time APIs to snake_case.
packages/standard-library/system/io.sr Removes old IO module file.
packages/standard-library/structures.sr Adds Result, Array, and Map structural types.
packages/standard-library/math.sr Changes package name used by Math library.
packages/standard-library/io.sr Adds new io module with print/read/read_file returning Result.
packages/compiler/tests/test_type_inference.cpp Updates tests for new identifier/chained expression nodes and call representation.
packages/compiler/tests/test_generics.cpp Adds generics regression coverage for function signature mismatch scenario.
packages/compiler/tests/test_chained_accessor.cpp Adds broad integration + unit tests for chained access/subscript/indirect call typing.
packages/compiler/src/stl/stride_runtime.cpp Minor cleanup of _printf_internal.
packages/compiler/src/ast/type_inference.cpp Adds chained expression + indirect call inference; changes identifier resolution path.
packages/compiler/src/ast/traversal/traversal.cpp Updates traversal for new AST nodes and array accessor base expression.
packages/compiler/src/ast/traversal/import_visitor.cpp Migrates import AST model; supports packages spanning multiple files.
packages/compiler/src/ast/nodes/types/types.cpp Switches named-type parsing to alias-type parsing; adjusts alias/object lookup path.
packages/compiler/src/ast/nodes/types/type_metadata.cpp Refactors type metadata parsing (arrays/optional) and alias-unwrap usage.
packages/compiler/src/ast/nodes/types/type_definition.cpp Passes generic parameters into type parsing options.
packages/compiler/src/ast/nodes/types/primitive_type.cpp Updates primitive type parsing to new type-metadata API.
packages/compiler/src/ast/nodes/types/object_type.cpp Adjusts object member parsing and object-type internal naming/type-name formatting.
packages/compiler/src/ast/nodes/types/function_type.cpp Refactors function type parsing to new type-metadata API.
packages/compiler/src/ast/nodes/types/alias_type.cpp Renames “named type” parsing to “alias type”; changes underlying-type resolution API/behavior.
packages/compiler/src/ast/nodes/return_statement.cpp Adds extra IR diagnostic output on return-type cast mismatch.
packages/compiler/src/ast/nodes/import.cpp Reworks import parsing to store identifiers and allow trailing commas.
packages/compiler/src/ast/nodes/functions/function_declaration.cpp Supports expression-bodied lambdas; improves void-return error reporting.
packages/compiler/src/ast/nodes/functions/function_call.cpp Refactors call callee resolution; improves indirect-call support and forward ref resolution.
packages/compiler/src/ast/nodes/expressions/variable_reassignation.cpp Moves reassignment target from string name to identifier node; improves type checks.
packages/compiler/src/ast/nodes/expressions/object_initializer.cpp Tightens generic-arg count checking and improves object init to_string/forward ref handling.
packages/compiler/src/ast/nodes/expressions/member_accessor.cpp Replaces old member accessor with AstChainedExpression + adds AstIndirectCall parsing/codegen.
packages/compiler/src/ast/nodes/expressions/identifier.cpp Adds get_definition() and uses it for codegen lookup; improves error on unresolved identifier.
packages/compiler/src/ast/nodes/expressions/expression.cpp Implements unified postfix parsing loop for ., [], and () chaining.
packages/compiler/src/ast/nodes/expressions/array_member_accessor.cpp Changes array accessor base to any expression; adds new pointer recovery logic in codegen.
packages/compiler/src/ast/nodes/expressions/array_initializer.cpp Simplifies SourceFragment creation with combine helper.
packages/compiler/src/ast/nodes/enumerables.cpp Adds enum member default values by index; tweaks enum formatting/to_string and forward refs.
packages/compiler/src/ast/generics.cpp Improves generic instantiation error messages and object generic resolution behavior.
packages/compiler/src/ast/context/type_registry.cpp Renames struct-type registry accessor to object-type accessor.
packages/compiler/src/ast/closures.cpp Adds prefer_captures disambiguation when selecting a lambda function in IR.
packages/compiler/src/ast/ast.cpp Adjusts statement parsing dispatch (type parsing now in phase 2).
packages/compiler/include/ast/visitor.h Updates import visitor bookkeeping for multi-file packages.
packages/compiler/include/ast/type_inference.h Exposes inference APIs for chained expression and indirect calls.
packages/compiler/include/ast/parsing_context.h Adds FunctionDefinition::is_variadic() helper.
packages/compiler/include/ast/nodes/types.h Changes alias/object type APIs and parsing option structure (incl. generic type names).
packages/compiler/include/ast/nodes/import.h Updates import node to store package/import identifiers instead of Dependency struct.
packages/compiler/include/ast/nodes/expression.h Introduces AstChainedExpression, AstIndirectCall; refactors function call + array accessor models.
packages/compiler/include/ast/nodes/enumerables.h Updates enum parsing signature and adds forward ref hook.
packages/compiler/include/ast/flags.h Reassigns several flag bit values and adds SRFLAG_TYPE_GENERIC_REF.
packages/compiler/include/ast/closures.h Updates lambda lookup signature with prefer_captures.
packages/compiler/config-json-schema.json Removes unused config schema stub.
packages/compiler/compilation-diagram.md Removes unused compilation diagram doc.
example.sr Updates example program to new stdlib APIs and enum usage.
.idea/codeStyles/Project.xml Adds Stride right-margin/soft-margin settings.
.github/workflows/ci.yml Runs ./gradlew clean test for IntelliJ plugin CI job.
Files not reviewed (1)
  • .idea/codeStyles/Project.xml: Language not supported
Comments suppressed due to low confidence (1)

packages/standard-library/time.sr:13

  • Time.sleep calls sleep(milliseconds) with the same name as the wrapper function, which will resolve to itself and recurse indefinitely. Rename either the extern or the module-level wrapper (or qualify the call) so the wrapper calls the extern/system implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread scripts/run-tests.sh
Comment thread packages/compiler/src/ast/type_inference.cpp
Comment on lines +174 to +178
private fun shouldWrap(node: ASTNode): Boolean {
val maxWidth = strideSettings.MAX_LINE_WIDTH
val textLen = computeSingleLineLength(node)
return textLen > maxWidth
}
Comment on lines +117 to +141
// If the base is a pointer to an alloca of array type, load the stored
// pointer first (arrays are always behind a pointer in stride).
if (base_ptr->getType()->isPointerTy())
{
if (const auto* alloca_inst = llvm::dyn_cast<llvm::AllocaInst>(base_ptr))
{
llvm::Type* allocated_ty = alloca_inst->getAllocatedType();
if (allocated_ty->isArrayTy())
{
// The alloca holds a pointer to the array data. Load it.
llvm::Value* array_ptr = builder->CreateLoad(
llvm::PointerType::getUnqual(module->getContext()),
base_ptr,
"array_ptr"
);

llvm::Value* element_ptr = builder->CreateInBoundsGEP(
elem_llvm_ty,
array_ptr,
index_val,
"array_elem_ptr"
);

return builder->CreateLoad(elem_llvm_ty, element_ptr, "array_load");
}
Comment thread scripts/run-tests.sh
Comment thread packages/compiler/src/ast/nodes/return_statement.cpp Outdated
Comment thread packages/compiler/src/ast/nodes/types/object_type.cpp Outdated
@VxTi VxTi merged commit 9a64cf5 into main Mar 14, 2026
3 checks passed
@VxTi VxTi deleted the feature/add-enum-support branch March 14, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants