Same package, but different file: type not found

Hi, everybody!

If I didn’t misunderstood docs, types within a package should be mutually visible without importing. It doesn’t work for me, however.

File1:

package common.basic.sprites;

enum SpriteKind { ... };
typedef SpRegistry = Map<SpriteKind,Int>;
interface ISprite { 

File2:

package common.basic.sprites;

class BasicSprite implements ISprite {
private var reg:SpRegistry; 

Compiler complains about SpRegistry - type not found. What am I doing wrong here? Interestingly, it apparently has no problem with ISprite - so it is visible, but SpRegistry is not even if they are in the same package.

import common.basic.sprites.ISprite.SpRegistry
Should do it.

The types not matched by the file name need to be explicitly pulled out.

1 Like

Thank you! It does work. Is there an idiomatic way to pull all types from a certain file?
I tried

import common.basic.ISprite.*;

But types remained unrecognized until i imported them all one-by-one.

This imports all types in the ISprite module:

import common.basic.ISprite;
1 Like

Gah!, yeah sorry. That would be the sensible thing.