Skip to content

Preserve a Team constant written in a Color slot instead of wrapping it in Color(...) #306

Description

@e54-bot

Goal

A Team constant written where a Color parameter is expected keeps its authored form through parse and emit, so it is not charged an extra element.

Context

OWBastion/Bastion passes a Team value in a Color position (playEffect(..., DynamicEffect.ECHO_STICKY_BOMB_EXPLOSION, Team.2, eventPlayer, 200)). Pinned OverPy 9.7.10 writes it as written, Team 2, and the client imports that. workshop-rs writes Color(Team 2):

input:  Play Effect(All Players(All Teams), Echo Sticky Bomb Explosion Effect, Team 2, Event Player, 200);
emit:   Play Effect(All Players(All Teams), Echo Sticky Bomb Explosion Effect, Color(Team 2), Event Player, 200);

The project has 14 such calls (Team 1 four times, Team 2 ten times); OverPy also writes Color(Team N) in 14 other Play Effect calls and 28 Create Effect calls where the source used the Color constant. The client counts the Wright build of this project 20 elements above the OverPy build (30090 against 30070), and OverPy's own accounting charges the wrapper one element, so these 14 account for most of the difference. The remaining 6 are not isolated; candidates are the single False/True count difference and the While condition spelling below.

While((a) && (b) && (c) && (d)) in OverPy's output is written as While(And(And(And(a, b), c), d)) by workshop-rs (rule [Hero/D.Va] Sync remech charge); whether the client counts them the same is unknown.

Scope

  • Keep the authored spelling of a value whose type differs from the parameter's when the client accepts it (evidence: OverPy's output is imported), instead of resolving it to the parameter's enum member.
  • Cover it with a regression test in en-US and zh-CN.
  • Record whether the infix boolean chain and the nested And cost the same in the client.

Non-goals

  • Element-count model (separate issue).
  • Warning about the type slip in the source (a source-language diagnostic).

Acceptance criteria

  • Parse then emit of the Play Effect line above reproduces the input.
  • On the project above the Wright build's Color( count equals OverPy's.

Dependencies

Related: #302, ADR-0014, ADR-0015.

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions