Skip to content

fix(windows): resolve build failure and improve cross-platform support#13

Merged
zombocoder merged 3 commits into
zombocoder:mainfrom
sashml:fix/windows-upstream
Apr 27, 2026
Merged

fix(windows): resolve build failure and improve cross-platform support#13
zombocoder merged 3 commits into
zombocoder:mainfrom
sashml:fix/windows-upstream

Conversation

@sashml
Copy link
Copy Markdown
Contributor

@sashml sashml commented Apr 26, 2026

Fixes #2

Summary

  • .gitattributes — enforce LF line endings and UTF-8 without BOM across all text files
  • src/Runtime/Value.hpp/cpp — introduce O2L_HAS_INT128 macro and is_long_ tag so the Value variant works on platforms where __int128 is unavailable (MSVC/Windows); add holds_Int_Value / get_Int_Value / holds_Long_Value / get_Long_Value index-based helpers for MSVC-safe variant access
  • All 157 src/ files — replace std::holds_alternative<Int/Long> and std::get<Int/Long> calls with the new helpers (MSVC rejects type-based lookup when two variant alternatives share the same underlying type)
  • tests/CMakeLists.txt — link wininet and ws2_32 on Windows
  • tests/test_system_fs_path.cpp — wrap Unix-only absolute-path assertions in #ifndef _WIN32; add Windows-specific equivalents
  • README.md — add Windows build instructions (MSVC 19.40, Ninja, vcpkg) satisfying the "clear instructions for Windows developers" acceptance criterion
  • CHANGELOG.md — document the cross-OS milestone

Test plan

  • CI passes on windows-latest runner
  • CI still passes on ubuntu-latest and macos-latest
  • No regressions in existing test suite (478 tests)

- Add .gitattributes to enforce LF line endings and UTF-8 without BOM
- Introduce O2L_HAS_INT128 macro and is_long_ flag in Value to handle
  platforms without __int128 (MSVC/Windows)
- Add holds_Int_Value/get_Int_Value/holds_Long_Value/get_Long_Value
  helpers for MSVC-safe variant access throughout all AST/Runtime files
- Replace hardcoded variant index switch in ComparisonNode with
  type-safe holds_alternative chain to fix bad_variant_access on Windows
- Fix JsonLibrary.cpp: revert 6 call sites back to holds_alternative<Int>
  for JsonValue contexts (distinct type from o2l::Value)
- Fix tools/o2l-lsp-server/main.cpp: add popen/pclose aliases for MSVC
- Add wininet and ws2_32 link targets for Windows in tests/CMakeLists.txt
- Guard Unix-only path assertions in test_system_fs_path.cpp with
  _WIN32 ifdefs
- Guard Int/Long identity tests in test_runtime.cpp with O2L_HAS_INT128
- Guard LongToIntConversion test with O2L_HAS_INT128 (Long==Int on MSVC)
- Update README with Windows build instructions and CHANGELOG entry

Closes zombocoder#2
@sashml sashml force-pushed the fix/windows-upstream branch from d187a6c to 0ac2e11 Compare April 27, 2026 01:34
@zombocoder zombocoder merged commit 3fad1d7 into zombocoder:main Apr 27, 2026
6 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.

Fix Windows build failure in GitHub Actions

2 participants