Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Could not find declaration/symbol" inside a with #184

Closed
JinShil opened this issue Jan 29, 2015 · 10 comments
Closed

"Could not find declaration/symbol" inside a with #184

JinShil opened this issue Jan 29, 2015 · 10 comments
Assignees
Labels
Milestone

Comments

@JinShil
Copy link

JinShil commented Jan 29, 2015

I have the following code:

with(RCC.CIR)
    {
        setBitFields
        !(
              CSSC.value,        false
            , PLLSAIRDYC.value,  false
            , PLLI2SRDYC.value,  false
            , PLLRDYC.value,     false
            , HSERDYC.value,     false
            , HSIRDYC.value,     false
            , LSERDYC.value,     false
            , LSIRDYC.value,     false
            , PLLSAIRDYIE.value, false
            , PLLI2SRDYIE.value, false
            , PLLRDYIE.value,    false
            , HSERDYIE.value,    false
            , HSIRDYIE.value,    false
            , LSERDYIE.value,    false
            , LSIRDYIE.value,    false
        )();
    }

I am able to get information on RCC and RCC.CIR, but setBitFields, CSSC, etc... return "Could not find declaration" and "Could not find symbol" error messages in dcd-server.

Arch LInux 64. Compiled with DMD v2.066

@Hackerpilot
Copy link
Collaborator

What does dcd-client --version print?

@JinShil
Copy link
Author

JinShil commented Jan 30, 2015

dcd-client --version
v0.4.1-dev 387a65e4f14885f9aafe50533511ac9cc3d65759

@Hackerpilot
Copy link
Collaborator

That's the most recent. My basic testing shows that switch statements work the way I expect them to. Can you reduce your code to a small file that reproduces the issue?

@JinShil
Copy link
Author

JinShil commented Jan 30, 2015

It's not a switch statement, it's a with. But I'll try to put together a simple full example that illustrates the problem.

@Hackerpilot
Copy link
Collaborator

Sorry, I meant "with".

@JinShil
Copy link
Author

JinShil commented Jan 30, 2015

I'm having a trouble reproducing this in a contrived example. I'll do some more investigation on my main project this weekend.

@JinShil
Copy link
Author

JinShil commented Jan 30, 2015

Ok, I figured it out. It looks like the problem has to do with the inheritance in the following code:

abstract class InheritMe(T)
{
    final abstract class GrandChild(U, V)
    {
        /// I am uvalue
        static U uvalue;

        /// I am vvalue
        static V vvalue;

        /// I am setGrandChild
        static void setGrandChild(alias X, alias Y)()
        {
            X = Y;
        }
    }
}


final abstract class Parent(T)
{
    /// I am stringChild
    final abstract class StringChild : InheritMe!(string)
    {
        /// I am a string GrandChild
        alias s = GrandChild!(T, string);

        /// I am an int GrandChild
        alias i = GrandChild!(T, int);
    }

    /// I am a parentF
    static void parentF()
    {

    }
}

/// I am stringParent
alias stringParent = Parent!string;

void main(string[] args)
{
    with(stringParent.StringChild.s)
    {
        setGrandChild
        !(
              uvalue, "test"
        )();
    }
}

dcd-server can't seem to resolve setGrandChild or uvalue. The code compiles fine in DMD 2.066.

@Hackerpilot
Copy link
Collaborator

So much inderection! This will make a good test case.

@Hackerpilot Hackerpilot self-assigned this Jan 30, 2015
@Hackerpilot Hackerpilot added this to the 0.4.1 milestone Jan 30, 2015
Hackerpilot added a commit that referenced this issue Jan 30, 2015
@Hackerpilot
Copy link
Collaborator

So it turns out that almost everything about inheritance is broken and you're the first person to point it out. :-)

@JinShil
Copy link
Author

JinShil commented Jan 30, 2015

Beautiful! (and I use that word literally). Everything works great. Nice Work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants