Skip to content
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

Confusing error message about "partially applied functor" #181

Open
1 of 5 tasks
JohnReppy opened this issue Jul 16, 2022 · 0 comments
Open
1 of 5 tasks

Confusing error message about "partially applied functor" #181

JohnReppy opened this issue Jul 16, 2022 · 0 comments
Assignees
Labels
bug Something isn't working compiler problem with compiler gforge bug (or feature request) ported from smlnj-gforge repository

Comments

@JohnReppy
Copy link
Contributor

Version

110.96

Operating System

  • All
  • Linux
  • macOS
  • Windows
  • Other Unix

OS Version

No response

Processor

No response

Component

Core system

Severity

Cosmetic

Description of the problem

When there is a type error in a functor definition,
where the functor is then applied to produce a structure,
there is a confusing error message about the functor
application:

Error: structure A defined by partially applied functor

Transcript

- local
=   functor F() : sig val x : int end = struct val x = "abs" end
= in
=   structure A = F()
= end;
stdIn:2.11-2.63 Error: value type in structure does not match signature spec
    name: x
  spec:   int
  actual: string
stdIn:4.17-4.20 Error: structure A defined by partially applied functor

Expected Behavior

No response

Steps to Reproduce

local
functor F() : sig val x : int end = struct val x = "abs" end
in
structure A = F()
end;

Additional Information

No response

Email address

jhr@cs.uchicago.edu

Comments from smlnj-gforge

Original smlnj-gforge bug number 246

Submitted via web form by John Reppy jhr@cs.uchicago.edu on 2020-37-31 at 17:3700

Keywords: modules

comment by @dmacqueen on 2020-55-25 00:5500 +000 UTC

The problem is that the check for a partially applied functor in a structure declaration (around line 1254 in elabmod.sml) is inaccurate when the functor declaration produces an error. A proper fix will require a somewhat delicate propagation of ERROR values (ERRORstr and ERRORfct) during module elaboration. The propagation needs to be more thorough, but not so aggressive that type checking is left out in other parts of the structures with bogus components.

@JohnReppy JohnReppy added bug Something isn't working compiler problem with compiler gforge bug (or feature request) ported from smlnj-gforge repository labels Jul 16, 2022
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 gforge bug (or feature request) ported from smlnj-gforge repository
Projects
None yet
Development

No branches or pull requests

2 participants