Skip to content

A builder member the runtime does not have transpiles, and fails only in the browser #679

Description

@edgarmesquita

What happens

The BCL audit grades every StringBuilder member native (tests/eQuantic.UI.Compiler.Tests/Coverage/bcl-surface.baseline.txt), and a verdict there only says that a strategy answered. The runtime's builder has append, appendLine, insert, remove, replace, clear, toString and a length getter, and eqc writes every other member under its own name, which the browser does not find:

  • sb.AppendFormat("{0}-{1}", 1, 2) emits sb.appendFormat(...), a TypeError in the browser, where .NET appends 1-2
  • sb.AppendJoin(",", items) emits sb.appendJoin(...), a TypeError, where .NET appends a,b
  • sb.Capacity and sb.MaxCapacity read undefined, where .NET answers 16 and 2147483647, and sb.EnsureCapacity(100) is a TypeError
  • sb[0] reads undefined and sb[0] = 'x' writes a property nobody reads, where .NET reads and writes the char
  • sb.Length = 1 is a TypeError, the runtime's length having no setter, where .NET cuts the text, and pads it with \0 past its end
  • sb.Append(CultureInfo.InvariantCulture, $"x{1.5}") emits sb.append(CultureInfo.invariantCulture, ...), which hands the provider to the parameter the runtime reads as the value, and AppendLine with a provider does the same

Measured with eqc on the head of #667 (db2e1ca), while fixing #650 there, and on .NET 10 with dotnet fsi. Nothing fails at build time.

Direction

The runtime's builder carries the members a page can reach, each answering as .NET's does, and eqc fences the ones that cannot cross (GetChunks, the span and memory overloads). The provider overloads belong with the culture work of #637. A conformance case per member would turn each native line into a proof, as BclOverloadConformanceTests does for the static surface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions