Skip to content

Better kind-checking of SAWScript types #2764

@samcowger

Description

@samcowger

#2748 modified SAWScript parsing in a way that allowed users to write previously-syntactically-invalid types, like Int Int. SAWScript currently fails to reject such a type as ill-kinded. SAW even allows values of such types to be constructed without resorting to undefined:

sawscript> let x : Int Int = return 0
sawscript> :t x
Int Int
sawscript> print x
[17:05:52.428] return 0
sawscript>

More comprehensive kind-checking ought to put a stop to this.

In terms of code, note that a fix for this may go hand in hand with substantially reworking or removing the BlockCon AST node, into which all type constructor applications are currently parsed and through which kind-checking flows. Several notes (authored by @sauclovian-g in #2157) suggest that BlockCon ought to be removed outright:

-- XXX: while BlockCon exists, ContextCon has kind * and you
-- have to use BlockCon to paste a result type to a ContextCon.
-- (BlockCon should be removed. Then ContextCon has kind * -> *
-- like you'd expect.)

-- XXX special case for BlockCon (remove along with BlockCon)

-- position associated with the monad context. (This part is a
-- result of BlockCon existing and can go away when BlockCon is
-- removed.)

Note also that (I believe) this issue encompasses much of the "other cleanup" referred to in #2163.

Metadata

Metadata

Assignees

Labels

subsystem: saw-scriptIssues related to the SAWScript language and/or its interpretation and executiontype: bugIssues reporting bugs or unexpected/unwanted behavior

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions