~xerool/fennel-ls#19: 
Working on types

Recently I started work on implementing type checker. I will use this ticket for implementation status reports and type checker related discussions.

Status
REPORTED
Submitter
~pluffie
Assigned to
No-one
Submitted
9 months ago
Updated
9 months ago
Labels
No labels applied.

~pluffie 9 months ago*

#Current state - WIP

Todos:

  • Return type of and isn't informative at all. Make it more informative.
  • Return type of or also isn't informative. See src/fennel-ls/typecheck.fnl:144.
  • Add some warnings for redundant code found using type information (for example, (= a b), where a and b have different type, is always false)
  • Extend . and : types to catch errors with invalid fields and have meaningful return type. See src/fennel-ls/typechecker.fnl:184.
  • Add type information for more builtins.
  • Add function argument type resolving.
  • Add function type annotations.
  • Dependent typing (at least basic).

Help welcomed. If someone want to help then I can publish existing code.

I've postponed the development. Debugging language servers is painful, especially if most of the code isn't yours. Currently I am writing debugger for Fennel to make development way easier.

~xerool 9 months ago

I actually use a debugger as part of my workflow.

It makes you write expressions and stuff in lua (so you have to write like _3fitem instead of ?item sometimes), but otherwise works very well.

https://github.com/slembcke/debugger.lua

I reassign debug.getinfo in test/init.fnl specifically to make the line numbers work in debugger.lua.

~pluffie 9 months ago*

~xerool, I saw it, but I think it can't remote debug. Debugging language server with remote debugger is much easier than with regular one.

By the way, I've almost done writing it.

~pluffie 9 months ago

Debugger is done.

Although I named it fnldbg, it actually work with Fennel as bad as debugger.lua does. Mangling is still a problem. Backtraces are still a problem if you are working with compiled code. I am fixing this right now.

Anyway, I'll continue working on type checker tomorrow.

Register here or Log in to comment, or comment via email.