Skip to content

UCS/UPS tracking issue #151

Description

@LPTK

Issue to track the parts of the UCS implementation that are still incomplete or wrong – please update with more cases as you find them.

Translation

Locations

  • Track scrutinee locations with Scrutinee.Source. (Note: it was removed in new desugarer.)

  • No location reported in:

    fun testF(x) = if x is
      Foo(a) then a
      Foo(a) then a
    //│ ╔══[WARNING] duplicated branch
    //│ ╙──

Reporting

  • Warn when an is test has a single pattern
    Though maybe we shouldn't warn when it's conjuncted with other things, as then the is may be used to bind expressions, as in if xs is x :: xs and mapPartition(f, xs) is (as, bs) and ...

String patterns overhaul

  • Make a PR that overhauls string patterns; currently, they misbehave in some cases; eg

    Example
    pattern Digits = ("0"..="9") ~ (Digits | "")
    pattern DigitsCommas = Digits | Digits ~ "," ~ DigitsCommas
    pattern Integer = "0" | ("1"..="9") ~ (DigitsCommas | "")
    pattern FractionalPart = "." ~ Digits
    pattern ExponentPart = ("e" | "E") ~ ("+" | "-" | "") ~ Integer
    
    // FIXME: does not work!
    // pattern NumberStr = Integer ~ (FractionalPart | "") ~ (ExponentPart | "")
    
    // Works
    pattern NumberStr = Integer | Integer ~ FractionalPart ~ (ExponentPart | "")
    
    // FIXME: `Number` doesn't recognize commas
    pattern AsNumber = (NumberStr & n) => Number(n)

Fix pattern extraction semantics

  • Patterns like Pair(0 => 1, 0 => 1) should rebuild the outer ctors
  • Patterns like C(_, 0 => 1) should fail when the first param of C is private, as the thing can't be rebuilt
  • Patterns like P(Transf) should warn about a discarded transformation when P is a HOP – users should write P(Transf as _) instead

Fixed point patterns

  • Avoid retraversing rec pattern prefixes when no change happened (see: EvaluationContexts2, StackParse)

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions