1

I'm getting the following error in the initializer in the chapel class I'm writing:

unresolved access of 'int(64)' by '()'

I've tried removing as much as possible from my code and am still getting the error, but only when I compile with the class code we've been given to test things. Here's the class:

use Time;
use Random;
use Semaphore;

class BlockingQueue {

    type eltType;

    var capacity : int; //total space

    //var elementsDomain : domain(1);

    var elements : [0..0] eltType;

    var numElements : int; //current number of items

    proc init(type eltType, size : int) {
            this.eltType = eltType;
    }

    proc add(element : eltType){
      this.elements[0] = element;
    }

    proc remove() : eltType {
      return this.elements[0];
    }

}
var queue = new owned BlockingQueue(int, 1);
queue.add(13);
queue.add(19);
queue.add(14);
writeln(queue);

Here is the testing class. My teacher gave me permission to post this.

https://raw.githubusercontent.com/paithan/OSChapelTests/master/testBlockingQueue.chpl

the class is using chapel version 1.18

  • You don't appear to be doing anything with `size` in your init procedure – ptb Apr 04 '19 at 15:30
  • I'm unable to reproduce the problem. Which version of Chapel are you using? I don't have your Semaphore.chpl and the problem might be there. In my testing, I commented out the Semaphore-related sections (so it would compile) and then got an error about missing BlockingQueue.getNumElements(). I added that and it compiled with 1.19. Another note, I understand that it's unclear if this is a bug or a question, but here are two reasonable alternatives to S.O. questions: the gitter channel https://gitter.im/chapel-lang/chapel and bug reports: https://chapel-lang.org/docs/usingchapel/bugs.html – mppf Apr 04 '19 at 16:04
  • On which line number is this occurring? Errors like this usually occur when indexing into a variable or expression of type integer, or when calling them as though they were a function. For example, see: https://tio.run/##S85ILEjN@f@/LLFIocJKITOvxJqrvCizJDUnT6Mi2jhW01pBQV9fIb9IAS6qYaypaf3/PwA – Brad Apr 04 '19 at 16:56

0 Answers0