Skip to content

Last branch of case expression omitted from PPAst #241

Description

@JohnReppy

Version

v110.98

Operating System

  • All
  • Linux
  • macOS
  • Windows
  • Other Unix

OS Version

Ubuntu 18.04

Processor

No response

Component

Core system

Severity

Minor

Description of the problem

When printing a CaseExp using PPAst, the last branch is omitted from printing.

One potential fix would be to remove the trim function, using rules instead of trim rules. (I'm not sure what the reasoning behind trim is in the first place, though.)

Transcript

- val pd : PrettyPrint.device = {consumer = print, linewidth = Fn.const 80, flush = fn () => TextIO.flushOut TextIO.stdOut};
val pd = {consumer=fn,flush=fn,linewidth=fn} : ?.PrettyPrint.PP.device
- val dec = SmlFile.parse (Source.newSource ("demo", TextIO.openString "case 0 of 0 => 0", false, ErrorMsg.defaultConsumer ()));
val dec =
  SeqDec
    [MarkDec
       (ValDec ([Vb {exp=MarkExp #,lazyp=false,pat=VarPat #}],[]),(2,18))]
  : Ast.dec
- let val strm = PrettyPrint.openStream pd in PPAst.ppDec NONE strm (dec,6) before PrettyPrint.closeStream strm end;
val it =
      (case 0
      )val it = () : unit

Expected Behavior

No response

Steps to Reproduce

val pd : PrettyPrint.device = {consumer = print, linewidth = Fn.const 80, flush = fn () => TextIO.flushOut TextIO.stdOut};
val dec = SmlFile.parse (Source.newSource ("demo", TextIO.openString "case 0 of 0 => 0", false, ErrorMsg.defaultConsumer ()));
let val strm = PrettyPrint.openStream pd in PPAst.ppDec NONE strm (dec,6) before PrettyPrint.closeStream strm end;

Additional Information

No response

Email address

No response

Comments from smlnj-gforge

Original smlnj-gforge bug number 270

Submitted on 2020-08-08 at 21:35:00

Keywords: pretty-print

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompilerproblem with compilerfixed-in-110.99.3issues that will be fixed in the 110.99.3 versiongforgebug (or feature request) ported from smlnj-gforge repository

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions