spencersalazar / chuck

28 stars 8 forks source link

Order of class definitions in a file matters sometimes #31

Open heuermh opened 10 years ago

heuermh commented 10 years ago

As described in the comment here

Sample.ck, line 25 https://github.com/heuermh/lick/blob/master/Sample.ck#L25

if the order of class definitions in that file are rearranged such that Sample comes before the other classes (SampleProcedure, SampleIntProcedure, etc.) then the ChucK compiler reports an error

$ chuck --loop &
$ chuck + import.ck
...
[Sample.ck]:line(72): function 'asProcedure@0@Sample' was defined
with return type 'Procedure' -- but returning type 'SampleProcedure'
[Sample.ck]: ...in function 'asProcedure'

Generally the order of class definitions in a file should not matter.