HeliosLang / compiler

Helios is a DSL for writing Cardano smart contracts. This library lets you compile Helios scripts and build Cardano transactions.
https://www.hyperion-bt.org/helios-book
BSD 3-Clause "New" or "Revised" License
139 stars 30 forks source link

nested module: import error-reporting issue #105

Closed rjharmon closed 10 months ago

rjharmon commented 11 months ago

compiling a Program that imports a module with this wrong syntax throws a generic "unexpected undefined value" error.

module Foo

struct DelegateDetails {
    name:  String
    addrs: Address[]
}

Expected an error with src: attribute pointing to the right file & error position - same as when the wrong syntax is in the spending script:

TypeError on line 5: 'Address' isn't a parametric instance

christianschmitz commented 11 months ago

v0.15.13 hopefully fixes this

rjharmon commented 11 months ago

Well, the error is different now : )

Sorry I didn't give a stack trace before - here's the current trace

TypeError: Cannot read properties of undefined (reading 'asDataType')
 ❯ DestructExpr.evalDestructExprs node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:32042:72
 ❯ checkType node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:32146:9
 ❯ DestructExpr.evalInAssignExpr node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:32157:4
 ❯ AssignExpr.evalInternal node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:29415:24
 ❯ AssignExpr.eval node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:28632:23
 ❯ FuncLiteralExpr.evalInternal node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:30575:32
 ❯ node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:34724:24
 ❯ TypeParameters.evalParametricFuncType node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:33527:16
 ❯ TypeParameters.evalParametricFunc node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:33544:21
 ❯ FuncStatement.evalInternal node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:34711:34
 ❯ FuncStatement.eval node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:34748:22
 ❯ Module.evalTypes node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:41772:6
 ❯ MintingProgram.evalTypesInternal node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:42281:6
 ❯ MintingProgram.evalTypesInternal node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:42966:26
 ❯ MintingProgram.evalTypes node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:43017:15
 ❯ Function.newInternal node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:42078:28
 ❯ Function.new node_modules/.pnpm/@hyperionbt+helios@0.15.13/node_modules/@hyperionbt/helios/helios.js:42038:18

(from Program.new(src, modules) in my code)

rjharmon commented 10 months ago

looks good, thanks