brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 111 forks source link

Definitions provides with well-formedness/scoping errors aren't reported in REPL #1517

Open jpolitz opened 4 years ago

jpolitz commented 4 years ago

Since the repl works by changing provides to (effectively) provide *, if there are well-formedness issues in the provides block, they are ignored.

On master:

provide { bogus: bogus } end

x = 10

Does not report an error, but would report that bogus is unbound if imported.

On horizon:


provide:
  data MyPosn hiding (j, MyPosn), # j is not reported as nonsense
  type MyPosn as P
end
data MyPosn:
  | pos2d(x, y)
  | pos3d(x, y, z)
end

Does not report that j is nonsense from main, but does if that file is imported.

Note that these cases do report the right error if they are run as a main program from the command-line, because then they aren't treated as definitions, they're treated as modules to compile with their provides block.

jpolitz commented 4 years ago

Fixed by https://github.com/brownplt/pyret-lang/commit/79baa53a3ab87c90802971563fdd0695ece2eb28