-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revert: lifting globals from inflight classes defined in preflight fa…
- Loading branch information
Showing
276 changed files
with
416 additions
and
2,757 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
64 changes: 14 additions & 50 deletions
64
examples/tests/valid/inflight_class_capture_preflight_object.test.w
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 |
---|---|---|
@@ -1,54 +1,18 @@ | ||
bring cloud; | ||
bring "./subdir2" as subdir; | ||
// https://github.com/winglang/wing/issues/2730 | ||
// FAILING: | ||
|
||
let b = new cloud.Bucket(); | ||
// bring cloud; | ||
|
||
inflight class Foo { | ||
pub uploadToBucket(k: str, value: str) { | ||
b.put(k, value); | ||
assert(b.get(k) == value); | ||
} | ||
// let b = new cloud.Bucket(); | ||
// let myConst = "bang bang"; | ||
|
||
static pub fooStatic() { | ||
b.put("a", "b"); | ||
assert(b.list() == ["a"]); | ||
} | ||
} | ||
// inflight class Foo { | ||
// uploadToBucket(k: str, value: str) { | ||
// b.put(k, value); | ||
// } | ||
// } | ||
|
||
test "inflight class captures preflight resource" { | ||
let f = new Foo(); | ||
f.uploadToBucket("hello.txt", "world"); | ||
} | ||
|
||
test "inflight class type captures preflight resource" { | ||
Foo.fooStatic(); | ||
} | ||
|
||
|
||
let getFoo = inflight () => { | ||
return new Foo(); | ||
}; | ||
|
||
test "inflight class qualified without explicit reference" { | ||
// Get instance of Foo without mentioning the type | ||
let foo = getFoo(); | ||
// Now Foo needs to be qualified correcly | ||
foo.uploadToBucket("greetings.txt", "universe"); | ||
} | ||
|
||
test "inflight class defined inflight captures preflight object" { | ||
class Foo2 { | ||
pub uploadToBucket() { | ||
b.put("x", "y"); | ||
assert(b.get("x") == "y"); | ||
} | ||
} | ||
|
||
let f = new Foo2(); | ||
f.uploadToBucket(); | ||
} | ||
|
||
test "bring inflight class from subdir" { | ||
let x = new subdir.InflightClass(); | ||
assert(x.method() == "What did you expect?"); | ||
} | ||
// test "inflight class captures preflight resource" { | ||
// let f = new Foo(); | ||
// f.uploadToBucket("hello.txt", "world"); | ||
// } |
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 |
---|---|---|
|
@@ -8,5 +8,3 @@ pub class Bar { | |
return @dirname; | ||
} | ||
} | ||
|
||
pub inflight class InflightBar {} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.