Home My Page Projects Code Snippets Project Openings SML/NJ Bugs
Summary Activity Tracker Lists

[#188] Missing warning for nonexhaustive valbind patterns

Date:
2017-10-19 14:52
Priority:
3
State:
Open
Submitted by:
Jackson Woodruff (jwoodruff)
Assigned to:
David MacQueen (dbm)
Machine Architecture:
x86
Operating System:
All
Component:
Compiler
Resolution:
Accepted As Bug
Severity:
Minor
OS Version:
SML/NJ Version:
110.82 (trunk)
Keywords:
Warning
URL:
Transcript (of reproduction):
Source (for reproduction):
Summary:
Missing warning for nonexhaustive valbind patterns

Detailed description
Hi all,

Currently, SMLNJ does not emit a warning for the following code:

val x = fn y => let
val nil = [1]
in
y
end

According to page 32, item number 3 in the definition of ML http://sml-family.org/sml97-defn.pdf, this must emit a warning informing the user that the match is invalid.

A further note to this matter is that MosML and PolyML both successfully report a warning in this case.

Jackson.

As a precise example of what I mean:
[15:50:24]
Poly/ML 5.6 Release
> val x = fn y => let val nil = [1] in y end;;
poly: : warning: Pattern is not exhaustive. Found near val nil = [1]
val x = fn: 'a -> 'a
> %

[15:50:40]
Standard ML of New Jersey v110.79 [built: Wed Nov 2 06:06:36 2016]
- val x = fn y => let val nil = [1] in y end;;
val x = fn : 'a -> 'a
-

Comments:

Message  ↓
Date: 2017-11-01 18:20
Sender: John Reppy

This bug appear to be related to 130.

Attached Files:

Changes

Field Old Value Date By
assigned_tonone2017-11-01 18:20jhr
Operating SystemNone2017-11-01 18:20jhr
ResolutionNone2017-11-01 18:20jhr