-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
107 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...ct.wollok.tests/src/org/uqbar/project/wollok/tests/typesystem/xpect/objectLiterals.wlk.xt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* XPECT_SETUP org.uqbar.project.wollok.tests.typesystem.xpect.TypeSystemXpectTestCase END_SETUP */ | ||
|
||
class Persona { | ||
|
||
// XPECT type at hambriento --> { cena } | ||
var hambriento = object { | ||
var a = 0 | ||
|
||
method cena() { | ||
return a | ||
} | ||
} | ||
|
||
// XPECT type at charlatan --> { habla } | ||
var charlatan = object { | ||
method habla() = "Hola" | ||
} | ||
|
||
// XPECT type at multifacetico --> { habla; cena } | ||
var multifacetico = object { | ||
method habla() = "Chau" | ||
method cena() = 100 | ||
} | ||
|
||
// XPECT type at friki --> { habla; cena } | ||
var friki = object { | ||
method habla() = 42 | ||
method cena() = "Wollok" | ||
} | ||
|
||
// XPECT methodType at comida() --> () => Number | ||
method comida() = hambriento.cena() | ||
|
||
// XPECT methodType at comidaMulti() --> () => Number | ||
method comidaMulti() = multifacetico.cena() | ||
|
||
// XPECT methodType at comidaRara() --> () => String | ||
method comidaRara() = friki.cena() | ||
|
||
// XPECT warnings --> "{ habla } does not understand cena()" at "charlatan.cena()" | ||
method comidaConLaBocaAbierta() = charlatan.cena() | ||
|
||
|
||
// XPECT methodType at charla() --> () => String | ||
method charla() = charlatan.habla() | ||
|
||
// XPECT methodType at charlaMulti() --> () => String | ||
method charlaMulti() = multifacetico.habla() | ||
|
||
// XPECT methodType at charlaRara() --> () => Number | ||
method charlaRara() = friki.habla() | ||
|
||
// XPECT warnings --> "{ cena } does not understand habla()" at "hambriento.habla()" | ||
method charlaConEstomagoVacio() = hambriento.habla() | ||
|
||
|
||
// XPECT methodType at hacerHablarACharlatan() --> () => String | ||
method hacerHablarACharlatan() = self.hacerHablar(charlatan) | ||
|
||
// XPECT methodType at hacerHablarAMultifacetico() --> () => String | ||
method hacerHablarAMultifacetico() = self.hacerHablar(multifacetico) | ||
|
||
// XPECT! methodType at hacerHablarAFriki() --> () => Number | ||
// method hacerHablarAFriki() = self.hacerHablar(friki) | ||
|
||
// XPECT! warnings --> "{ cena } doesn't match with { habla } ... TO CHECK" | ||
// method hacerHablarAHambriento() = self.hacerHablar(hambriento) | ||
|
||
// XPECT methodType at hacerHablar(personalidad) --> (({ habla ; cena }|{ habla })) => String | ||
method hacerHablar(personalidad) = personalidad.habla() | ||
|
||
|
||
// XPECT methodType at hacerHablarQueNuncaSeUsa(personalidad) --> (Any) => Any | ||
method hacerHablarQueNuncaSeUsa(personalidad) = personalidad.habla() | ||
|
||
// XPECT methodType at charlatanString() --> () => String | ||
method charlatanString() = charlatan.toString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters