Selective import seems to be importing more than just specified symbol

WhatMeWorry kheaser at gmail.com
Wed Jan 8 02:07:46 UTC 2025


-----------------------------------------------------------
module redblacktree;

import std.container : RedBlackTree;
import honeycomb : Location;   // Seems to import all of 
honeycomb.d symbols

struct Node
{
     this(Location locaction, uint f)
     {
         this.location = location;
         this.f = f;
     }
     Location location;
     uint f;
}


unittest
{
     auto priorQ = new RedBlackTree!(Node, "a.f < b.f", true);
     Node n1 = Node( Location(1,2), 33);
     // etc.
}
-----------------------------------------------------------

I'm trying to retrofit unit testing in an existing D project. But 
when I run the
command:

rdmd -main -unittest redblacktree.d

This error is returned:

honeycomb.d(11): Error: unable to read module `sdl`
honeycomb.d(11):        Expected 'bindbc\sdl.d' or 
'bindbc\sdl\package.d' in one of the following import paths:
import path[0] = .
import path[1] = C:\D\dmd2\windows\bin64\..\..\src\phobos
import path[2] = C:\D\dmd2\windows\bin64\..\..\src\druntime\import

honeycomb.d module is just:

-----------------------------------------------------------
module honeycomb;

import bindbc.sdl;

struct Location   // holds a hex of a hexboard
{
     int r;  // row
     int c;  // colum
}
-----------------------------------------------------------

I thought that the line
import honeycomb : Location;
would only import the symbol struct Location?



More information about the Digitalmars-d-learn mailing list