Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/algorithms/DotProductViaPhaseEstimation.qs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ operation IterativePhaseEstimation(
}

/// # Summary
/// This is state preperation operator A for encoding the 2D vector (page 7)
/// This is state preparation operator A for encoding the 2D vector (page 7)
operation StateInitialisation(
TargetReg : Qubit,
AncilReg : Qubit,
Expand Down
2 changes: 1 addition & 1 deletion samples/algorithms/PhaseEstimation.qs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ operation EstimateEigenvalue(

/// # Summary
/// Given a qubit register `qs` measure each qubit in the register
/// assume reults represent a binary fraction in little-endian order
/// assume results represent a binary fraction in little-endian order
/// and return the fraction as a `Double` value.
operation MeasureBinaryFractionLE(qs : Qubit[]) : Double {
mutable result = 0.0;
Expand Down
4 changes: 2 additions & 2 deletions samples/algorithms/PhaseFlipCode.qs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ operation ChangeBasis(qs : Qubit[]) : Unit is Adj {
operation CorrectError(logicalQubit : Qubit[]) : Unit {
Fact(Length(logicalQubit) == 3, "`logicalQubit` must be length 3");

// Entangle the parity of the physical qubits into two auxillary qubits.
// Entangle the parity of the physical qubits into two auxiliary qubits.
use aux = Qubit[2];
ChangeBasis(logicalQubit);
CNOT(logicalQubit[0], aux[0]);
Expand All @@ -130,7 +130,7 @@ operation CorrectError(logicalQubit : Qubit[]) : Unit {
CNOT(logicalQubit[2], aux[1]);
ChangeBasis(logicalQubit);

// Measure the parity information from the auxillary qubits.
// Measure the parity information from the auxiliary qubits.
let (parity01, parity12) = (M(aux[0]), M(aux[1]));
ResetAll(aux);

Expand Down
4 changes: 2 additions & 2 deletions samples/algorithms/SimpleVQE.qs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ operation PrepareAnsatzState(qs : Qubit[], thetas : Double[]) : Unit {
}

/// # Summary
/// Bosonic exitation circuit from the referenced paper.
/// Bosonic excitation circuit from the referenced paper.
operation BosonicExitationTerm(
theta : Double,
moX : Qubit,
Expand All @@ -117,7 +117,7 @@ operation BosonicExitationTerm(
}

/// # Summary
/// Non-bosonic exitation circuit from the referenced paper.
/// Non-bosonic excitation circuit from the referenced paper.
operation NonBosonicExitataionTerm(
theta : Double,
moXsoX : Qubit,
Expand Down
2 changes: 1 addition & 1 deletion samples/algorithms/SuperdenseCoding.qs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ operation Main() : ((Bool, Bool), (Bool, Bool)) {
return ((sourceBit1, sourceBit2), (decodedBit1, decodedBit2));
}

// Generates random bit using an auxilliary qubit
// Generates random bit using an auxiliary qubit
operation DrawRandomBit() : Bool {
use q = Qubit();
H(q);
Expand Down
2 changes: 1 addition & 1 deletion samples/language/CustomMeasurements.qs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// The @Measurement attribute in Q# allows you to define custom measurements
// that are lowered to QIR in the same way the `M` measurement in the standard
// library is lowered. That means an `"irreversible"` attribute is added to
// the callable declaration and the output results are moved to the paramaters
// the callable declaration and the output results are moved to the parameters
// and treated as result registers.
//
// # Who is this for?
Expand Down
2 changes: 1 addition & 1 deletion samples/language/Qubit.qs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import Std.Diagnostics.DumpMachine;

/// In the below code, all varibles have type annotations to showcase their type.
/// In the below code, all variables have type annotations to showcase their type.
operation Main() : Unit {
// The following statement allocates three qubits.
use qs = Qubit[3];
Expand Down
2 changes: 1 addition & 1 deletion samples/language/Range.qs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Value literals for the Range type are expressions of the form `start..step..stop`, where `start`, `step`,
// and `end` are expressions of type `Int`. If the step size is one, it may be omitted. For example,
// `start..stop` is a valid `Range` literal and the same as `start..1..stop`. Closed ranges specify the
// `start` and `end` are provied, but open ranges may be expressed by omitting either or both of these
// `start` and `end` are provided, but open ranges may be expressed by omitting either or both of these
// using the `...` syntax in one of the following forms: `start...`, `...end`, `...`. Open ranges may only
// be used in array slices.

Expand Down
2 changes: 1 addition & 1 deletion samples/language/Specializations.qs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/// specializations (`Adj + Ctl`).
operation DoNothing() : Unit is Adj + Ctl {}

/// Here, the specializations hvae been explicitly defined.
/// Here, the specializations have been explicitly defined.
/// In the following example, the declaration for an operation SWAP,
/// which exchanges the state of two qubits q1 and q2, declares an
/// explicit specialization for its adjoint version and its controlled
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc/src/incremental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ impl Compiler {
}

/// Returns the ID of the source package created from the sources
/// passed in during inital creation.
/// passed in during initial creation.
#[must_use]
pub fn source_package_id(&self) -> PackageId {
self.source_package_id
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc/src/interpret/circuit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ fn operation_with_subsequent_qubits_no_added_rows() {
.assert_eq(&circ.to_string());
}

/// Tests that invoke circuit generation throught the debugger.
/// Tests that invoke circuit generation through the debugger.
mod debugger_stepping {
use super::Debugger;
use crate::target::Profile;
Expand Down
4 changes: 2 additions & 2 deletions source/compiler/qsc/src/qasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ pub fn compile_openqasm(unit: QasmCompileUnit, package_type: PackageType) -> Com

// We allow the best effort compilation, but for errors we only
// want to provide OpenQASM OR Q# errors. Otherwise we get confusing
// error reporting and duplicate errors (like undeclared idenfifier and
// error reporting and duplicate errors (like undeclared identifier and
// type errors)
let surfaced_errors = if openqasm_errors.is_empty() {
// we have no OpenQASM errors, surface the Q# compliation errors
// we have no OpenQASM errors, surface the Q# compilation errors
compile_errors
} else {
// We have OpenQASM errors, convert them to the same type as as the Q#
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ pub struct TyDef {
}

impl TyDef {
/// Returns true if the tye definition satisfies the conditions for a struct.
/// Returns true if the type definition satisfies the conditions for a struct.
/// Conditions for a struct are that the `TyDef` is a tuple with all its top-level fields named.
/// Otherwise, returns false.
#[must_use]
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_circuit/src/json_to_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ fn map_register_field(field: Option<&Value>) -> Vec<Value> {
register.insert("result".to_string(), c_id.clone());
}
// Note: if "qId" is missing, the json deserialization later on
// will fail and produce the approprate error
// will fail and produce the appropriate error
if let Some(q_id) = item.get("qId") {
register.insert("qubit".to_string(), q_id.clone());
}
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_codegen/src/qir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ impl ToQir<String> for rir::Callable {
self.call_type,
rir::CallableType::Measurement | rir::CallableType::Reset
) {
// These callables are a special case that need the irreversable attribute.
// These callables are a special case that need the irreversible attribute.
" #1"
} else {
""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn empty_string() {
fn offset_out_of_bounds() {
let contents = "hello";
let pos = Position::from_utf8_byte_offset(Encoding::Utf8, contents, 10);
// Sould return the <eof> position
// Should return the <eof> position
expect![[r"
Position {
line: 0,
Expand All @@ -44,7 +44,7 @@ fn position_out_of_bounds() {
column: 10,
};
let offset = pos.to_utf8_byte_offset(Encoding::Utf8, contents);
// Sould return the <eof> offset
// Should return the <eof> offset
assert!(offset == contents.len() as u32);
}

Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_eval/src/intrinsic/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ fn check_intrinsic_output(file: &str, expr: &str, expect: &Expect) {
let mut out = GenericReceiver::new(&mut stdout);
match check_intrinsic(file, expr, &mut out) {
Ok(..) => expect.assert_eq(
&String::from_utf8(stdout).expect("content should be convertable to string"),
&String::from_utf8(stdout).expect("content should be convertible to string"),
),
Err(e) => expect.assert_eq(&e.to_string()),
}
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_fir/src/fir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn set_indentation<'a, 'b>(
0 => indent.with_str(""),
1 => indent.with_str(" "),
2 => indent.with_str(" "),
_ => unimplemented!("intentation level not supported"),
_ => unimplemented!("indentation level not supported"),
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_fir/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn set_indentation<'a, 'b>(
0 => indent.with_str(""),
1 => indent.with_str(" "),
2 => indent.with_str(" "),
_ => unimplemented!("intentation level not supported"),
_ => unimplemented!("indentation level not supported"),
}
}

Expand Down
8 changes: 4 additions & 4 deletions source/compiler/qsc_linter/src/linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn run_lints(
}

/// This function is used by our unit tests, to make sure lints aren't duplicated under
/// normal circunstances. The `run_lints` functions deduplicates the lints to take care
/// normal circumstances. The `run_lints` functions deduplicates the lints to take care
/// of a few special cases where the same expression (referring to the same span in the
/// source code) appears referenced in multiple places in the HIR.
pub(crate) fn run_lints_without_deduplication(
Expand Down Expand Up @@ -225,7 +225,7 @@ impl Diagnostic for Lint {
}

/// A lint level. This defines if a lint will be treated as a warning or an error,
/// and if the lint level can be overriden by the user.
/// and if the lint level can be overridden by the user.
#[derive(Debug, Clone, Copy, Default, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub enum LintLevel {
Expand All @@ -234,11 +234,11 @@ pub enum LintLevel {
Allow,
/// The lint will be treated as a warning.
Warn,
/// The lint will be treated as a warning and cannot be overriden by the user.
/// The lint will be treated as a warning and cannot be overridden by the user.
ForceWarn,
/// The lint will be treated as an error.
Error,
/// The lint will be treated as an error and cannot be overriden by the user.
/// The lint will be treated as an error and cannot be overridden by the user.
ForceError,
}

Expand Down
4 changes: 2 additions & 2 deletions source/compiler/qsc_lowerer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ impl Lowerer {
hir::ExprKind::Assign(lhs, rhs) => {
let idx = self.exec_graph.len();
let lhs = self.lower_expr(lhs);
// The left-hand side of an assigment is not really an expression to be executed,
// The left-hand side of an assignment is not really an expression to be executed,
// so remove any added nodes from the execution graph.
self.exec_graph.drain(idx..);
fir::ExprKind::Assign(lhs, self.lower_expr(rhs))
Expand Down Expand Up @@ -521,7 +521,7 @@ impl Lowerer {
let idx = self.exec_graph.len();
let container = self.lower_expr(container);
// The left-hand side of an array index assignment is not really an expression to be
// executed, so remove any added nodes from the exection graph.
// executed, so remove any added nodes from the execution graph.
self.exec_graph.drain(idx..);
fir::ExprKind::AssignIndex(container, index, replace)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl EvaluationContext {
}
}

/// Struct that represents a block node when we intepret an RIR program as a graph.
/// Struct that represents a block node when we interpret an RIR program as a graph.
pub struct BlockNode {
/// The ID of the block.
pub id: BlockId,
Expand Down
4 changes: 2 additions & 2 deletions source/compiler/qsc_partial_eval/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ impl<'a> PartialEvaluator<'a> {
rhs_expr_id: ExprId,
bin_op_expr_span: PackageSpan, // For diagnostic purposes only.
) -> Result<EvalControlFlow, Error> {
// Consider optimization of array in-place operations instead of re-using the general binary operation
// Consider optimization of array in-place operations instead of reusing the general binary operation
// evaluation.
let lhs_expr = self.get_expr(lhs_expr_id);
let lhs_expr_package_span = self.get_expr_package_span(lhs_expr_id);
Expand Down Expand Up @@ -1705,7 +1705,7 @@ impl<'a> PartialEvaluator<'a> {

let callable_id = self.get_or_insert_callable(callable);

// Resove the call arguments, create the call instruction and insert it to the current block.
// Resolve the call arguments, create the call instruction and insert it to the current block.
let (args, ctls_arg) = self
.resolve_args(
(store_item_id.package, callable_decl.input).into(),
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_qasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The two languages have many differences, and insofar as possible, the compilatio

QIR specific semantic constraints:

- OpenQASM ouput registers are declared with a fixed size and not all of the indexes may be populated with measurements. In QIR, `Result`s can only ever be acquired through measurement. So if all entries in an output register aren't measured into, a code generation error will occur.
- OpenQASM output registers are declared with a fixed size and not all of the indexes may be populated with measurements. In QIR, `Result`s can only ever be acquired through measurement. So if all entries in an output register aren't measured into, a code generation error will occur.

Semantic details

Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_qasm/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub struct QasmCompiler {
/// The output semantics to follow when compiling to Q# AST.
/// The program type to compile to.
pub config: CompilerConfig,
/// The compiled statments accumulated during compilation.
/// The compiled statements accumulated during compilation.
pub stmts: Vec<qsast::Stmt>,
pub symbols: SymbolTable,
pub errors: Vec<WithSource<crate::Error>>,
Expand Down
4 changes: 2 additions & 2 deletions source/compiler/qsc_qasm/src/display_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::fmt::{self, Display, Write};

/// Takes a unicode buffer or stream and wraps it with
/// `indenter::Idented`. Which applies an indentation of 1
/// `indenter::Indented`. Which applies an indentation of 1
/// each time you insert a new line.
fn with_indentation<T>(f: &mut T) -> indenter::Indented<'_, T>
where
Expand All @@ -14,7 +14,7 @@ where
set_indentation(indent, 1)
}

/// Takes an `indenter::Idented` and changes its indentation level.
/// Takes an `indenter::Indented` and changes its indentation level.
fn set_indentation<T>(indent: indenter::Indented<'_, T>, level: usize) -> indenter::Indented<'_, T>
where
T: fmt::Write,
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_qasm/src/lex/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use std::{
enum NumberLexError {
/// A number ending in an underscore.
EndsInUnderscore,
/// An incomplete binary, octal, or hex numer.
/// An incomplete binary, octal, or hex number.
Incomplete,
/// The token wasn't parsed and no characters were consumed
/// when trying to parse the token.
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_qasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub enum ErrorKind {
/// Q# requires qubits to be in the 0 state before and after use.
/// Qiskit makes no assumptions about the state of qubits before or after use.
///
/// During compliation, if Qiskit semantics are used, the compiler will insert
/// During compilation, if Qiskit semantics are used, the compiler will insert
/// calls to create qubits instead of `use` bindings. This means that later
/// compiler passes won't generate the Q# code that would check the qubits.
///
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_qasm/src/parser/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ fn parse_many_boxable_stmt(s: &mut ParserContext) -> Result<List<Stmt>> {
/// 8. `Ident q;`
///
/// (1) is a quantum-gate-call, (2) is a binary operation, (3) is a function call, and
/// (4) is an identifer. We don't know for sure until we see the what is beyond the gate
/// (4) is an identifier. We don't know for sure until we see the what is beyond the gate
/// name and its potential classical parameters.
///
/// Therefore, we parse the gate name and its potential parameters using the expr parser.
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_qasm/src/semantic/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl Expr {
}
ExprKind::SizeofCall(_) => {
// We only lower SizeofCall expressions that should be evaluated
// at runtime. The ones that can be const evaluated are hanlded
// at runtime. The ones that can be const evaluated are handled
// in [`Lowerer::lower_sizeof_call_expr`].
None
}
Expand Down
2 changes: 1 addition & 1 deletion source/compiler/qsc_qasm/src/semantic/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ pub enum SemanticErrorKind {
#[error("return statements on a non-void subroutine should have a target expression")]
#[diagnostic(code("Qasm.Lowerer.MissingTargetExpressionInReturnStmt"))]
MissingTargetExpressionInReturnStmt(#[label] Span),
#[error("control counts must be postitive integers")]
#[error("control counts must be positive integers")]
#[diagnostic(code("Qasm.Lowerer.NegativeControlCount"))]
NegativeControlCount(#[label] Span),
#[error("non-void def should always return")]
Expand Down
Loading
Loading