fixes (#14 and more) & compile-time literal casting & improved error reporting, robustness & test coverage#12
Merged
russo-2025 merged 82 commits intomasterfrom Mar 15, 2026
Merged
Conversation
Changed the V setup GitHub Action from vlang/setup-v@v1 to vlang/setup-v@v1.4 in both CI and manual release workflows for improved compatibility and stability.
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.
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.
There was a problem hiding this comment.
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
None + 1or undefined types in expressions — proper errors shown insteadNoneas default value in properties and function parameters now handled correctlyint Property X = "123" Autois now valid)papyrus versioncommand — shows version, build date, git commit and build type-pexflag added to explicitly select PEX backendextendsor a variable declaration cannot be foundScriptnameis now validated to match the source file name