Skip to content

Annotated let/var does not materialize a str view (D22: annotation demands what it says) #781

Closed

Description

@ehartford

Repro

for __line in stdin.lines():
    var line: str = __line     # error: type mismatch in binding

D22/D27: a binding names what's there, an annotation demands what it says — var line: str = <&str view> establishes an owned demand and should materialize an independent str (clone), like tail-position returns already do. Instead it's a type mismatch, and the working spelling is the explicit __line.clone().

Hit while fixing the -p one-liner template (cli-selfhost-one-liner-tests); the template now uses .clone(). When this lands, the template can go back to the annotated spelling.

Activity

  1. ehartford commented on Aug 31, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-08-31: CLOSE (overcome by events). Fixed by 8d908d9 "explicit owned demand materializes a str view (#781)" — both the annotated-binding shape and the exact stdin.lines() repro run green on the current compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions