Skip to content

bugfix - materialize imported const str arguments (#638)#639

Merged
dannymeijer merged 1 commit into
release/v0.3from
bugfix/638-imported-const-str-materialization
May 22, 2026
Merged

bugfix - materialize imported const str arguments (#638)#639
dannymeijer merged 1 commit into
release/v0.3from
bugfix/638-imported-const-str-materialization

Conversation

@dannymeijer
Copy link
Copy Markdown
Contributor

Summary

This PR fixes imported public const str values at owned Incan str call sites. Public const metadata can arrive as a frozen string shape while the generated Rust item is still &'static str; the backend now treats borrowed/static/frozen string-like IR shapes as owned-string materialization candidates at Incan sinks, and string method receivers use AsRef<str> instead of emitting unstable .as_str() on raw &str constants.

It also bumps the release candidate to 0.3.0-rc8 and records #638 in the v0.3 release notes.

Type of change

  • Bug fix
  • New feature
  • Refactor / maintenance
  • Documentation
  • CI / tooling
  • RFC (adds/updates docs/RFCs/*)

Area(s)

Select the primary areas touched (used for review routing; labels are managed separately):

  • Incan Language (syntax/semantics)
  • Compiler (frontend/backend/codegen)
  • Tooling (CLI/formatter/test runner)
  • Editor integration (LSP/VS Code extension)
  • Runtime / Core crates (stdlib/core/derive)
  • Documentation

Key details

  • User-facing behavior: from registry import TOKEN where TOKEN is pub const TOKEN: str = "token" now works in str arguments, explicit TOKEN.to_string(), local str assignment, and ordinary string methods.
  • Internals: Owned Incan sinks now share a borrowed-string-like helper for StaticStr, StrRef, and FrozenStr, avoiding the prior StaticStr-only materialization gap.
  • Risks: FrozenStr receiver lowering now relies on AsRef<str>, which is intentionally broader than .as_str() and covered by both explicit FrozenStr smoke coverage and the imported-const repro.

Testing / verification

  • make test / cargo test
  • make examples (if relevant)
  • incan fmt --check . (if relevant)
  • Manual verification described below

Manual verification notes:

  • cargo test e2e_imported_const_str_materializes_at_test_call_sites
  • cargo test frozen_str_var_to_string
  • target/debug/incan test tests in /private/tmp/incan-638-imported-const-str
  • target/debug/incan run -c <FrozenStr smoke>
  • git diff --check
  • make pre-commit
  • make -C /Users/danny/Development/encero/InQL ci INCAN=/Users/danny/Development/encero/tmp/incan-636-api-metadata-decorated-signatures/target/debug/incan

Docs impact

  • No docs changes needed
  • Docs updated
  • Docs follow Divio intent (tutorial/how-to/reference/explanation) where applicable

If docs updated:

  • Link(s): workspaces/docs-site/docs/release_notes/0_3.md

Checklist

  • I kept public docs user-focused and moved internals to contributing docs when appropriate
  • I avoided duplicating canonical install/run instructions in multiple places
  • I added/updated tests where it materially reduces regressions

Closes #638

@incan-triage-bot incan-triage-bot Bot added documentation Improvements or additions to documentation incan compiler Suggestions, features, or bugs related to the Compiler (frontend/backend/codegen) labels May 22, 2026
@dannymeijer dannymeijer self-assigned this May 22, 2026
@dannymeijer dannymeijer added this to the 0.3 Release milestone May 22, 2026
@dannymeijer dannymeijer merged commit b4b9330 into release/v0.3 May 22, 2026
32 checks passed
@dannymeijer dannymeijer deleted the bugfix/638-imported-const-str-materialization branch May 22, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation incan compiler Suggestions, features, or bugs related to the Compiler (frontend/backend/codegen)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug - Decorator and imported const str arguments are not materialized as str call arguments

1 participant