pyret-lang icon indicating copy to clipboard operation
pyret-lang copied to clipboard

Confusing error message when a file includes two files where the second includes the third

Open sidwan02 opened this issue 4 years ago • 1 comments

Confusing error message generates when a file (a) is including two files (b and c) where one also includes the other (b includes c). Eg: file3.arr includes file2.arr and file1.arr file2.arr includes file1.arr

file1 and file2 must both contain data types and tests of either functions or methods using the datatypes defined in the files. file3 may be empty.

Running file3 in such a scenario generates the error message: image

  1. The error message is confusing
  2. The blue highlight does not seem to refer to anything (for the green and peach highlights, hovering over the error part makes the corresponding include statements flash, nothing happens when hovering over the blue highlight in the error)

Code to reproduce: file1.arr

provide:
  *, 
type *
end

data TemporalUnit:
  | unit-year
end

fun is-date-based() -> Boolean:
  true
end

check "is-date-based: positive cases":
  is-date-based() is true
end

file2.arr

include my-gdrive("file1.arr")

provide:
  *, 
type *
end

data Duration:
  | duration
end

fun get-units() -> TemporalUnit:
  unit-year
end

check "get-units: no units present":
  get-units() is unit-year
end

file3.arr

include my-gdrive("file2.arr")
include my-gdrive("file1.arr")

sidwan02 avatar Jan 19 '21 04:01 sidwan02

Whoa. That’s not good. That’s a generated variable that doesn’t get correctly gensymed. Yikes. The quick workaround is to comment out tests in the files that are imported. We can fix this, though, by fixing check block desugaring to not have each block’s results captured for export, which shouldn’t happen.

Thanks for reporting!

On Mon, Jan 18 2021 at 8:55 PM, Siddharth Diwan < [email protected] > wrote:

Confusing error message generates when a file (a) is including two files (b and c) where one also includes the other (b includes c). Eg: file3.arr includes file2.arr and file1.arr file2.arr includes file1.arr

file1 and file2 must both contain data types and tests of either functions or methods using the datatypes defined in the files. file3 may be empty.

Running file3 in such a scenario generates the error message: image ( https://user-images.githubusercontent.com/70694457/104988870-294a8880-59e7-11eb-9208-15d5e57d74da.png )

  • The error message is confusing
  • The blue highlight does not seem to refer to anything (for the green and peach highlights, hovering over the error part makes the corresponding include statements flash, nothing happens when hovering over the blue highlight in the error)

Code to reproduce: file1.arr

provide: *, type * end

data TemporalUnit: | unit-year end

fun is-date-based() -> Boolean: true end

check "is-date-based: positive cases": is-date-based() is true end

file2.arr

include my-gdrive("file1.arr")

provide: *, type * end

data Duration:

| duration end

fun get-units() -> TemporalUnit: unit-year end

check "get-units: no units present": get-units() is unit-year end

file3.arr

include my-gdrive("file2.arr") include my-gdrive("file1.arr")

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub ( https://github.com/brownplt/pyret-lang/issues/1566 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAA5IUYTOAKBMEXS4CKRFSTS2UGEJANCNFSM4WIGTYUA ).

jpolitz avatar Jan 19 '21 05:01 jpolitz