Skip to content

Commit 17a1f0a

Browse files
author
estudiante
committed
Fix the first problem
1 parent 1d59945 commit 17a1f0a

5 files changed

Lines changed: 56 additions & 18 deletions

File tree

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 19 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/ko/carbonel/compiler/intermediate/tinyRust/ts/TypeEntry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public ClassEntry classLink() {
116116
public boolean isAssignableTo(TypeEntry type) {
117117
if (this.equals(type)) return true;
118118
if (isArray ^ type.isArray) return false;
119-
if (type.type.type().equals(TinyRustTokenType.VOID) && this.type.type().equals(TinyRustTokenType.NULL)) return true;
119+
if (type.type.type().equals(TinyRustTokenType.VOID)) return this.type.type().equals(TinyRustTokenType.NULL) || this.type.type().equals(TinyRustTokenType.VOID);
120120
if (this.classLink == null) throw new RuntimeException("Type " + this + " is not consolidated");
121121
if (type.classLink == null) throw new RuntimeException("Type " + type + " is not consolidated");
122122
return this.classLink.isAssignableTo(type.classLink);

src/test/resources/ast/41.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*ERROR
2+
IncompatibleTypesError
3+
*/
4+
class B{
5+
pub B: b, c;
6+
B: x;
7+
fn test(B: y) -> void{
8+
return new A();
9+
}
10+
}
11+
class A{
12+
fn test() -> void{
13+
}
14+
}
15+
fn main(){
16+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class A{
2+
I32: a1;
3+
fn m1(I32: p1)->void{
4+
I32: v1;
5+
return new A();
6+
}
7+
fn m2()->void{
8+
}
9+
create (){
10+
}
11+
}
12+
13+
class B: A{
14+
create(){
15+
}
16+
}
17+
18+
fn main(){
19+
}

0 commit comments

Comments
 (0)