# Weird: Simple actor does not compile

**URL:** <https://forum.dfinity.org/t/weird-simple-actor-does-not-compile/23017>\
**Category:** Motoko\
**Created:** [September 13, 2023, 11:28pm UTC](https://forum.dfinity.org/t/weird-simple-actor-does-not-compile/23017 "2023-09-13T23:28:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwertytrewq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/qwertytrewq/32/10423_2.png) [@qwertytrewq](https://forum.dfinity.org/u/qwertytrewq)\
**Post date:** [September 13, 2023, 11:28pm UTC](https://forum.dfinity.org/t/weird-simple-actor-does-not-compile/23017/1 "2023-09-13T23:28:55Z")

</div>

When trying to compile by `dfx deploy A`

```auto
actor B {
}

```

I get

```auto
/home/porton/t/test-dfx/src/B.mo:1.1-2.2: type error [M0014], non-static expression in library or module

```

Why doesn’t this sample compile? Workaround:

```auto
actor class B() {
}

```

Here is `A.mo`:

```auto
import Cycles "mo:base/ExperimentalCycles";
import B "./B";

actor class A() {
    public shared func init(): async () {
        Cycles.add(1000_000_000_000);
        // ignore await B.B();
    }
}

```

---

<div class="post-metadata">

**Author:** ![qwertytrewq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/qwertytrewq/32/10423_2.png) [@qwertytrewq](https://forum.dfinity.org/u/qwertytrewq)\
**Post date:** [September 14, 2023, 1:53am UTC](https://forum.dfinity.org/t/weird-simple-actor-does-not-compile/23017/2 "2023-09-14T01:53:03Z")

</div>

Weird: It is compiled fine by DFX.

The error message appears in MS Code text editor. Why the editor shows a message not appearing in compilation?!

---

<div class="post-metadata">

**Author:** ![qwertytrewq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/qwertytrewq/32/10423_2.png) [@qwertytrewq](https://forum.dfinity.org/u/qwertytrewq)\
**Post date:** [September 14, 2023, 1:54am UTC](https://forum.dfinity.org/t/weird-simple-actor-does-not-compile/23017/3 "2023-09-14T01:54:14Z")

</div>

Hm, closing and opening the file again in the editor has solved the problem.

---

<div class="post-metadata">

**Author:** ![qwertytrewq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/qwertytrewq/32/10423_2.png) [@qwertytrewq](https://forum.dfinity.org/u/qwertytrewq)\
**Post date:** [September 14, 2023, 1:56am UTC](https://forum.dfinity.org/t/weird-simple-actor-does-not-compile/23017/4 "2023-09-14T01:56:25Z")

</div>

The error appears regularly, when I edit the source file.

The problem disappears, when I close and reopen the source file.
