Skip to content

fixes (#14 and more) & compile-time literal casting & improved error reporting, robustness & test coverage#12

Merged
russo-2025 merged 82 commits intomasterfrom
replace-panics
Mar 15, 2026
Merged

fixes (#14 and more) & compile-time literal casting & improved error reporting, robustness & test coverage#12
russo-2025 merged 82 commits intomasterfrom
replace-panics

Conversation

@russo-2025
Copy link
Copy Markdown
Owner

@russo-2025 russo-2025 commented Jun 28, 2025

  • fix(Incorrect 'declaration is different' error with default parameters in states #14): calling functions with default parameters inside State blocks now validated correctly
  • fix: compiler no longer crashes on None + 1 or undefined types in expressions — proper errors shown instead
  • fix: None as default value in properties and function parameters now handled correctly
  • fix: comments inside parenthesized expressions and call argument lists no longer cause parser errors
  • fix: method call on temporary expression could produce incorrect bytecode (temp var freed too early)
  • feat: string/int/float/bool literals are now auto-converted to declared type in property defaults and function parameters (int Property X = "123" Auto is now valid)
  • feat: papyrus version command — shows version, build date, git commit and build type
  • feat: -pex flag added to explicitly select PEX backend
  • improve: compiler now reports a clear error when a type referenced in extends or a variable declaration cannot be found
  • improve: compiler now errors when two scripts with the same name exist in different source folders
  • improve: Scriptname is now validated to match the source file name
  • improve: default parameter values are now validated against the declared parameter type
  • improve: internal panics replaced with structured ICE diagnostic — shows version, phase, stack trace and a link to report the issue
  • test: added 22 integration tests compiling real Skyrim mod sources (iEquip, SexLab, OStim, Requiem, USSEP, and more)
  • test: added tests for compile-time casting, None handling, comment parsing, and error messages
  • chore: test sources moved to a git submodule
  • chore: V compiler updated to weekly.2025.48
  • chore: CI/CD updated to actions/checkout@v4, setup-v@v1.4, submodules: recursive

@russo-2025 russo-2025 changed the title replace panics replace panics | update v version Sep 15, 2025
@russo-2025 russo-2025 changed the title replace panics | update v version replace panics | update v version | update ci/cd | fix tests Sep 15, 2025
@russo-2025 russo-2025 changed the title replace panics | update v version | update ci/cd | fix tests replace panics | update v version | update ci/cd | small fix tests Sep 15, 2025
@russo-2025 russo-2025 changed the title replace panics | update v version | update ci/cd | small fix tests replace panics | update v version | update ci/cd Sep 15, 2025
Renamed all iEquip related script and README files from modules/tests/iEquip to modules/tests/iEquipSources for improved organization and clarity.
Introduces the MantellaSpellSources module with Papyrus scripts for conversation, actions, constants, equipment description, dialogue handling, and related functionality. Includes MIT license and README for documentation.
Added OStimSources directory containing Papyrus scripts and supporting files for OStim, including OAiScript.psc, OBarsScript.psc, and others. Also included the GNU GPL v3 license and a README for documentation.
Added PapyrusUtil, JsonUtil, MiscUtil, ObjectUtil, StorageUtil, and ActorUtil Papyrus scripts, along with a README referencing the source. These files provide utility functions for Skyrim mod development and are intended for use in the test modules.
Introduces ModEvent.psc and NetImmerse.psc to the psc_deps test module. These scripts provide extended mod event handling and node manipulation functions for testing and integration purposes.
Renamed proj_iequip_test.v to project_iequip_test.v and updated the test function and input directory to reflect new naming and source location.
Renamed test file and function from 'proj_sexlab_test' to 'project_sexlab_test' for improved clarity and consistency.
Introduces a test for compiling the Mantella spell project, verifying input and header directories, and ensuring output directory creation. Uses builder.compile with specific preferences for compilation.
Introduces a new test in project_ostim_test.v to verify compilation of OStim sources with required dependencies and output directory setup.
Added multiple Papyrus script files and a README to modules/tests/UIExtensionsSources, sourced from https://www.nexusmods.com/skyrim/mods/57046. These scripts provide various UI extension menu implementations for Skyrim mod testing.
Added RaceMenu Papyrus scripts and README to modules/tests/RaceMenuSources for testing purposes. These files are sourced from https://www.nexusmods.com/skyrim/mods/29624.
Added new Papyrus script files for Potion, SKSE, Scene, SoundDescriptor, TopicInfo, Weather, and WorldSpace to support SKSE-dependent features in tests. Also added GetEquippedArmorInSlot to Actor.psc for armor slot queries.
Introduces NiOverride.psc and ArmorAddon.psc to the NiOverrideSources test module. These scripts provide native Papyrus interfaces for manipulating armor, weapon, skin, and node overrides, as well as body morphs and dye functions for Skyrim modding.
@russo-2025 russo-2025 changed the title fixes | add more checks | add more tests | add test projects | replace panics | update v version | update ci/cd fixes #14 | add more checks | add more tests | add test projects | replace panics | update v version | update ci/cd Dec 25, 2025
Corrected the indentation of the prefs constant initialization for improved code readability and consistency.
Updated get_output_dir to prefix the compiled directory name with '__project_test_' to avoid potential naming conflicts or improve clarity in test output directories.
@russo-2025 russo-2025 requested a review from Copilot December 26, 2025 11:21
Copy link
Copy Markdown

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 pull request adds extensive test source files from multiple Skyrim modding projects (OStim NG and OSA) along with related dependencies. The changes provide test coverage for Papyrus script parsing and validation across a diverse set of real-world game modding scripts.

Key Changes:

  • Added comprehensive test scripts from OStim NG framework
  • Added test scripts from OSA (OpenSex Animation) framework
  • Added supporting library scripts (NiOverride, console utilities)

Reviewed changes

Copilot reviewed 143 out of 287 changed files in this pull request and generated 6 comments.

File Description
OStimNGSources/*.psc OStim NG framework scripts covering actors, threading, sequences, UI, and utilities
OSASources/*.psc OSA framework scripts for animation control, UI interaction, and global utilities
NiOverrideSources/ArmorAddon.psc NiOverride library script for armor manipulation

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

Comment thread modules/tests/OStimNGSources/OIntUtil.psc Outdated
Comment thread modules/tests/OStimNGSources/OFurniture.psc Outdated
Comment thread modules/tests/OStimNGSources/OActor.psc Outdated
Comment thread modules/tests/OStimNGSources/OActionData.psc Outdated
Comment thread modules/tests/OSASources/_oOmni.psc Outdated
Comment thread modules/tests/OSASources/_oOmni.psc Outdated
Added details about fixes for default parameter checks, new tests with third-party script compilation, and clarified previous entries.
Add checks in script_decl to ensure a .psc file's script name matches the file base name (case-insensitive) and to error if a script with the same name is already defined. Uses os.base/all_before_last for filename extraction and reports errors with node.name_pos.
Add AGENTS.md: a comprehensive system prompt and contributor guide for the Papyrus Compiler project. Documents project layout, compilation pipeline, key data structures, V language conventions, build/run/test commands, testing and mandatory rules, module dependency graph, implementation details, and common how-to tasks — intended to guide contributors and AI assistants working on the compiler.
Enhance the assertion in modules/papyrus/checker/checker.v to include a descriptive error message when a cast is invalid. The message prints the source and target type names via get_type_name to make debugging invalid cast attempts easier.
Introduce Checker.try_cast_to_type to validate casts (using can_cast/can_autocast) and report a clear error instead of unconditionally performing casts. Replace direct cast_to_type calls in infix expression checking with try_cast_to_type so casts are only applied on success. Also translate a couple of comments to English and add a test (none + 1) that expects a cast error from None to Int.
Document new features and fixes: add `version` command; allow string literals as default values for typed properties and parameters (auto-cast to declared type). Add compiler validations and error reporting for missing scripts (extends/variable types), duplicate script names across source folders, mismatched Scriptname vs filename, and type-compatibility of default parameters. Fix handling of `None` as default values and crashes when `None` appears in expressions; validate calls with default parameters inside State blocks. Cleanup and reorganize changelog entries.
Add guideline #8 to AGENTS.md requiring updates to the CHANGELOG.md 'Next Release' section for any user-visible behavior, feature, or bugfix. Entries must be written in English, aimed at compiler users (what they will observe), and must not mention internal implementation details, module/function names, or CI/build-only changes. Includes examples of good and bad changelog entries.
Add guards in the type checker to treat placeholder/undefined types as non-castable and emit undefined-type errors instead of crashing. Update try_cast_to_type to report undefined types for both source and target. Add Parser.skip_comments and call it in expr, fn arg parsing and call argument handling so comments inside parenthesized expressions and argument lists are accepted. Update tests and CHANGELOG to reflect the fixes and parser behavior improvements.
Add .gitmodules to configure repository submodules and remove a large number of files under modules/tests (CampfireSources, ConsoleUtilSources, FNISSources, JContainersSources, etc.). These deletions move bulky test/source modules out of the main repo and into submodules (or external management) to reduce repository size and centralize versioning of those component modules.
Bump actions/checkout to v4 and add `with: submodules: recursive` in CI and manual-release workflows to ensure repository submodules are checked out. Changes applied to .github/workflows/ci.yml and .github/workflows/manual-release.yml.
Point header_dir to the relocated psc_deps under modules/tests/sources and clean up the inline comments in the test. The Russian comments were translated to English and simplified (clarifying that some types may be placeholders but aren't required), ensuring the test uses the new directory layout and has clearer documentation.
Adjust test_selective_headers_loading to use the relocated PSC source file under modules/tests/sources/psc/TestSelectiveLoading.psc (was modules/tests/psc/TestSelectiveLoading.psc). This aligns the test with the repository restructure of PSC sources so the test loads the correct file path.
Update test src_file to point to modules/tests/psc/TestSelectiveLoading.psc instead of the incorrect modules/tests/sources/psc/... path. This corrects the file location used by the test so the PSC source is found during test runs.
Delete the unused Campfire source reference and remove the commented-out Campfire test. Update the Requiem test prefs to include the USSEP and SkyUI SDK 5.1 dependencies so Requiem builds with those integrations.
Make tests resilient to differing repo layouts by adding fallback path checks. In projects_test.v, get_source_dir now checks the new modules/tests/sources/<dir> layout, special-cases psc_deps, and falls back to modules/tests/<dir> before failing. In selective_headers_loading_test.v, header_dir resolution tries modules/tests/sources/psc_deps first then modules/tests/psc_deps, validating that Form.psc exists. These changes improve backward compatibility with submodule or layout changes.
Move the Discord invite badge to the top of both README.md and README.RU.md, add a project header image (docs/image.png), and remove the duplicate badge placement. This improves visibility and adds a visual header for the project.
Add the -g flag to the V compiler invocation in .github/workflows/manual-release.yml so the built binary includes debug information. This updates the Build Project step only; output path (bin/papyrus) and other flags remain unchanged.
Insert a ## V 0.0.4 section into CHANGELOG.md and update release notes. Documented improvements to error handling: clearer and more consistent error messages (e.g., 'undefined identifier') and structured internal compiler error diagnostics that include version info, a stack trace, and reporting instructions. Also cleaned up placeholder ellipses in the file.
Update README.md and README.RU.md to include the -g flag in the v compiler invocation (v -o "bin\papyrus.exe" -prod -g -gc none compiler.v). This ensures debug information is generated during compilation.
@russo-2025 russo-2025 changed the title fixes #14 | add more checks | add more tests | add test projects | replace panics | update v version | update ci/cd fix(#14) + feat: compile-time literal casting, improved error reporting, robustness & test coverage Mar 15, 2026
@russo-2025 russo-2025 changed the title fix(#14) + feat: compile-time literal casting, improved error reporting, robustness & test coverage fixes (#14 and more) & compile-time literal casting & improved error reporting, robustness & test coverage Mar 15, 2026
@russo-2025 russo-2025 merged commit 456458c into master Mar 15, 2026
15 checks passed
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