Skip to content

Last branch of case expression omitted from PPAst #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 5 tasks
JohnReppy opened this issue Jul 15, 2022 · 1 comment
Closed
1 of 5 tasks

Last branch of case expression omitted from PPAst #241

JohnReppy opened this issue Jul 15, 2022 · 1 comment
Assignees
Labels
bug Something isn't working compiler problem with compiler fixed-in-110.99.3 issues that will be fixed in the 110.99.3 version gforge bug (or feature request) ported from smlnj-gforge repository

Comments

@JohnReppy
Copy link
Contributor

JohnReppy commented Jul 15, 2022

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

@JohnReppy JohnReppy added bug Something isn't working compiler problem with compiler gforge bug (or feature request) ported from smlnj-gforge repository labels Jul 15, 2022
@dmacqueen dmacqueen added the fixed-in-110.99.3 issues that will be fixed in the 110.99.3 version label Jul 21, 2022
@dmacqueen
Copy link
Contributor

Fix was to remove call of trim function in Parse/ast/ppast.sml.

dmacqueen added a commit that referenced this issue Jul 22, 2022
Added updates for bug fixes for issues #177 and #241.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler problem with compiler fixed-in-110.99.3 issues that will be fixed in the 110.99.3 version gforge bug (or feature request) ported from smlnj-gforge repository
Projects
None yet
Development

No branches or pull requests

2 participants