StanzaOrg / lbstanza-old

L.B. Stanza Programming Language
Other
216 stars 23 forks source link

Add sensible error message for duplicate imports #178

Closed PhilippeFerreiraDeSousa closed 1 year ago

PhilippeFerreiraDeSousa commented 1 year ago

Change

Issue with duplicate imports:

defpackage hello-world :
  import core
  import json
  import json

println $ to-json-string("Hello world")
jstanza run hello-world.stanza     
hello-world.stanza:6.10: Ambiguous call to overloaded function to-json-string with arguments of type
(String). Possibilities are:
  to-json-string: JSON -> String at jitpcb/src/lib-json/lib-json.stanza:167.12
  to-json-string: JSON -> String at jitpcb/src/lib-json/lib-json.stanza:167.12

This only breaks if we call 1 function from the duplicated import, the proposed solution will make an error even if no function is called from the duplicated import.

I could not run the change

How do recompile? I get:

lbstanza$ ../jitx-client/stanza/stanza stz/driver -o my-stanza
/usr/bin/ld: cannot find -lasmjit
collect2: error: ld returned 1 exit status